Salesforce is a big ocean, and every day we learn something. While exploring SOQL in VS Code, I found an ability to export query output to CSV. Isn’t it a fantastic way to export query output in CSV directly from Visual Studio Code and share it with the Sales team or anyone if needed? That too without installing an additional plugin.

Let’s get started – but take a minute pause here – how about if you first learn how to run and save a query in Visual Studio code.

Please do so now if you haven’t gotten a chance to read my last blog on, Execute & Save Query in VScode. It will help to save queries in visual studio code to reuse them.

Let’s start with a real-time use case.

Use Case

In response to my previous blog, How to Execute a Query in Visual Studio Code, I received a message from Chris; how can we export SOQL query output to a CSV file from VS code. A lot of scrolling is required to analyze the result.




Connect Visual Studio Code to the org in which you want to execute the query and export output.

Use this link to set up and connect your org with Visual Studio Code.


  1. Click on the Explorer icon.
  2. Go to Project name | Scripts.
  3. Click on soql | Filename ( you want to execute and save output i.e. Account.soql ).
  4. Click on Switch Between SOQL Builder and Text Editor.
  1. Click on the Run Query button.
  1. Click on the .csv file button to export the output and save it.

You are Done!!!

I would love to hear about your experience with Visual Studio Code to execute SOQL and export data to the .csv file. How do you use it?

Join our newsletter.

No spam, just learning!

Continue Reading

Get a free consultation.

Call us today at (469) 790-0063

Schedule a Consultation

Leave a Reply