Forum Discussion
csv file column count parameter issue with tab / semicolon separator
- 1 year ago
Hi Goodkat ,
The question about your files and when you remove the column numbers is related with the first row of your file.
In the TAB one you have the 2025 being in the end of the line with a tabe for each of the columns. Not sure if it's visible on this image but you can check the indentation on the first line:
So it does not matter if you have the number of columns or not because there are the correct number of separators in the first line. If you delete all the tabs in the first row you will see that the final result will be a single column:
When you get to the semicolon this is not what is happening:
You can see that there is only a semicolon in the first row so it splits by 2 when you remove the column number.
In both cases if you want to make sure you have the correct number of columns you must:
- Connect to the CSV
- Select a separator that is not on the file
- Remove the top 2 rows
- Split columns by delimiter
- Promote headers
Be aware that this option will also hard code the number of columns because of the column names that will be hard coded into that specific function. You can try and write some specific function to get a dynamic number of columns based on the number of semicolon or tab or whatever other separator.
Dear MFelix,
Thank you so much for your reply! You put a lot of effort into your reply! I do see and appreciate that, as it did help me to understand the root cause of the problem now. Also your suggestion with the caveat that the 'split column by delimiter' will hardcode the number of columns by the need to assign names is very helpful and I totally see that limitation now.
By your thorough answer I now can stop going down that road and find another solution. (But first I MUST put your reply into my personal 'Power Query encyclopedia' to avoid that confusion in future 😉
Have a great weekend and stay healthy!
Best regards, Andreas