Import Data From Multiple Excel Files Into One Updatable SQL Server Table Without Coding



It's a sneaky way to get around coding and using visual studio to create a link between a folder and SQL server but it is as efficient as it can be!

The main idea is using Power BI's Query Editor to do all the boring work of merging data from multiple excel files for us into one table -also you can wrangle your data however you want- then exporting it using Dax Studio, So let's dig into it.

1- You Will Obviously Have To Download Dax Studio  

It is a free 8MBs tool that can be easily downloaded from here: DAX Studio - The ultimate client tool for working with DAX queries
It's easy to install so I'm not gonna explain it to you, sorry.


2- Have A Look On The Data  



So this is our data,
 It's a folder containing multiple
 excel files from which
 we want to extract our data and merge it.

It can be as many as it is 


3- Open The Good Power BI And Get Data


1- Open Power BI
2- Click on 'get data'
3- Select data from 'folder'
4- Select your desired folder and hit ok

This is basically query editor step you should be familiar with 



If you are not familiar with power query editor and how to transform data with it see this topic: The Best Way To Import Data From A Folder To Query Editor Without Getting Any Errors



This is the final result we wish to export to a SQL table 
You can wrangle it, make it as nice and clean as you want

Load the data and we are ready to go



4- Now The 'Dax Studio' Step

from external tools you will find 'Dax Studio' …. If you don't go up there and install it
then run it from external tools 

You can see our data is loaded and we are going to Dax Studio!

Our data is ready to go so from the 'Advanced' tab hit 'Export Data'

Choose 'SQL Tables'




Enter your server name and the database you want your table to be exported to

See that check box? we will explain how useful it can be at the end


Now Export your data 
And here is our good table!





5- So where is exactly the 'Updatable' Part?

Alright alright, I will tell you …
Suppose you opened one of the excel files and did some changes 
all you will have to do is:
1- open the same .pbix file we are using to export data and hit 'Refresh'
2- Export the data using Dax Studio again BUT:
  • Remember the check box? don't ever uncheck it cause that's where you tell SQL Server to delete any tables with the same name and insert the new ones which have our changes.

  • Also, remember that the name of the table is the same name as your query.

Regards.

Comments

Post a Comment

Popular posts from this blog

Integrating Python in Power BI With An Example Of Data Wrangling & Data Visualization

REDUCE Your Measures With Calculation Groups In Power BI

شرح الأداة الرائعة Tabular Editor للـ Power BI