Connecting to SQL Server | Power Query

Last modified date:

It is possible to connect to many data sources using Power Query (more in this article) and SQL Server database is one of them. This article will tell you how to set connection to SQL Server table directly from Excel in few simple steps.

Guide to Data Import and Connecting to SQL Server from Excel via Power Query

It is not needed to use Power Query to establish a connection with SQL Server although it is the most comfortable way. This way to import data can be found in article How to execute SQL query in Excel. But back to our topic.

We will import prepared view to SQL Server instance localhost\MOJEINSTANCE in database Temp. The view is named udv_SalesByProducts and it displays sales by product with time context. This view is needed to be imported into Excel together with connection to database so that we will be able to refresh the data in Excel whenever we want to.

In case you do not know where is your SQL server located or you do not hold access rights, let your IT admin help you.

Step 1) Select Power Query card in Excel – from database – from SQL Server database

Step 2) Fill in name of the server and database in which is the view located. You have an option to set SQL query to perform on the server. We will leave the field for the SQL command empty since object (view) is needed to be displayed.

Napojení na SQL Server

Step 3) In the last step, all that’s left to do is select object and confirm via load button. We also have an opportunity to edit data further and create steps continuity using Power query editor. These steps would perform after every update.

The table has been created on the newly created list. It contains data from SQL Server and it is possible to update it as you wish.

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Category: Power Query SQL Server Tags:

About Ing. Jan Zedníček - BI Developer, Finance controller

My name is Jan Zedníček and I work as a BI Developer at Kentico Software in Brno. Mostly you can see me there working in the office, but I also work partly as a freelancer. I have been working as a freelancer for many companies for more than 5 years, but Kentico is the matter of my heart. I used to work as a financial controller at companies like Aero Vodochody or Sberbank and I also used to be a bond program manager in Unicapital Investment group. When I am not at work, I like playing volleyball, chess, doing a workout in the gym and I enjoy tasting of best quality rums. I am trying to summarize all my knowledge on this website not to forget them (because of the rum effect, you know =) and to put them forward to anyone. Don´t worry about asking for help or writing some comments.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.