The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi all,
Just looking at an issue where someone is trying to import data from a folder to PowerBI desktop from their local files.
After doing a bit of research, I get the impression that getting data from a folder is only usful for combining files in a folder that are of the same file time and format.
Is it possible to, say for example, get data from a folder that contains both csv files and excel files, all the files of which are unrelated to each other so do not have the same format?
Cheers,
Will
I see. Then the question immediately arises: do you want to store data from these different formats in one table?
If so, you need to perform transformations on one/both tables to bring them to the same format and then make an append.
________________________
Memorable Member | Former Super User If I helped, please accept the solution and give kudos! |
Hi @lkalawski, thanks for your responce.
In short, no. I would need all the sources to be available as seperate tables to work with, effectively remaining as seperate files, just all being brought in through the same folder.
Cheers,
Will
Hi all, thanks for your comments.
The issue I have is that the files won't have the same data structure (columns) so under no circumstance should be combined into one table.
Cheers,
Will
Hi @willatkinson -, you can indeed import data from a folder, and it's commonly used to combine files of the same format and structure.
all the table if we follow the same column headers, we can combine it together as one single fine.
Have to configured the import for each file type, click "Close & Load" to load the data into Power BI.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
@willatkinson , Yes we can include both csv and excel but we need to filter it separately,
I found out some steps on net
Combine Files:
Power BI will show a preview of the files in the folder. Click on Combine & Load or Combine & Transform Data.
In the Combine Files dialog, Power BI will attempt to combine the files. Since your files are of different formats, you will need to handle them separately.
Separate File Types:
In the Power Query Editor, you will see a query that attempts to combine the files. You can modify this query to handle different file types.
Filter the Extension column to separate CSV files and Excel files.
Process CSV Files:
Filter the Extension column to only include .csv files.
Expand the Content column to load the CSV data.
Apply any necessary transformations to the CSV data.
Process Excel Files:
Duplicate the original query and filter the Extension column to only include .xlsx or .xls files.
Expand the Content column to load the Excel data.
Apply any necessary transformations to the Excel data.
Proud to be a Super User! |
|
Hi @willatkinson ,
The question is whether, despite having different formats, they have the same data structure (same columns). If so, you can of course write code that brings it together.
This can be done in two ways:
1.
2. Create connections to two sources in the M code and then append them.
User | Count |
---|---|
83 | |
83 | |
37 | |
34 | |
32 |
User | Count |
---|---|
92 | |
79 | |
62 | |
53 | |
51 |