Forum Discussion
Skip rows in CSV before it is parsed by Power BI
- 9 years ago
Hi Tom, Lydia,
Unfortunately neither of your suggestions fixed the problem I was experiencing but I have found a solution.
The .csv files I had been working with are generated as output from a portal and I had been trying to load them directly into PBI.
It seems that if I open the .csv in Excel and save it (without making any changes) I can then load it into PBI with no problem...
Not sure why this works, but it does...
Thanks for your suggestions,
Regards,
Tony
Hey Tony,
there is a way in Power Query
- Import the file
- Mark the complete table and choose "Remove Top Rows" from the context menu
I guess this is what your are looking for
Regards
- tonygd9 years agoRegular Visitor
Hi Tom,
Thanks for the suggestion. Unfortunately that doesn't do the trick because the rest of the rows have already been parsed by Power BI based on what it detected in the first row.. :smileyfrustrated: .
The challenge is that the "real data" is about 40 columns whereas the "header" is only about 6 columns so Power BI parses based on 6 columns meaning the the real data is wrapped and displaced...
I really need some way of jumping over the 1st "n" rows before the data is parsed.
Cheers,
Tony
- TomMartens9 years ago
Super User
Hey,
not sure what you mean by displaced. I created a sample file with
20 rows of garbage at beginning (3 columns)
10000 empty rows
10 valuable rows with 40 columns
The table contains 40 columns, of course the 10021st row has to be promoted as header and you also have to manually change the datatype of the column, but this has to be done just once and it's always a good idea to check the datatype.
Maybe you have to check the option "Data Type Detection" (this was not necessary during my testing)
Cheers
- Anonymous9 years agoNot applicable
tonygd,
After you import data from CSV to Power BI Desktop, in Query Editor, remove all steps except “Source” step in “APPLIED STEPS”, then use “Remove Top Rows” feature to remove rows.
If the above step doesn’t help, please share us sample CSV file and post expected result.
Regards,
Lydia- tonygd9 years agoRegular Visitor
Hi Tom, Lydia,
Unfortunately neither of your suggestions fixed the problem I was experiencing but I have found a solution.
The .csv files I had been working with are generated as output from a portal and I had been trying to load them directly into PBI.
It seems that if I open the .csv in Excel and save it (without making any changes) I can then load it into PBI with no problem...
Not sure why this works, but it does...
Thanks for your suggestions,
Regards,
Tony