Using VS Code Extension MSSQL instead of Excel Power Query for Easy Database Querying

Save a few minutes every time you want to query your database to check out some data by cutting Excel out of the equation. wrote this about 6 years ago and it was last updated about 6 years ago.

← Back to the Posts

I've been bypassing Power Query in Excel lately by going directly to our databases using SQL. This is really easy (compared to what I have been trying to do in the past) by using the Visual Studio Code Extension called mssql. Also checkout this Microsoft guide on how to use this vscode mssql extension.

Now instead of:

  • Powering up Excel
  • Opening the advanced editor in Power Query (Get and Transform)
  • Copying/pasting your snippets or writing your query
  • Loading to a worksheet
  • Total time 3 - 5 minutes

You can:

  • Open VS Code
  • Navigate to an existing text file with your .sql query
  • Hit Ctrl+Shift+E
  • Select the Database you want to Query
  • Watch the results flood into the new window
  • Total time <1 minute

I also use this Project Manager extension by alefragnani to quickly switch to my MSBI Data Catalog in VS Code. This is where I store all my .m, .pq and .sql files so I can backup in Git.