Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
good afternoon people. I'm trying to load a .CSV file through power query. In this file, the first 3 lines are the header, separated by a comma, and the rest are the records. However, despite having only 3 headers, in the records of lines 4, 6, 8 and 11, I have an extra comma. This should generate another column, but my power query is only considering 3 columns. Even when I change the delimiter to "space", only the 3 columns are considered. Can anyone know what could be happening?
My guess is the number of columns was hardcoded as '3' when the file was imported.
You can verify this by looking in the code line for the source step or in the 'Advanced Editor' and you should see something like...
Csv.Document(File.Contents("C:\pathToFile\TESTFILE.csv"), [Delimiter=",", Columns= 3])
If you have a fixed number of columns expected you can change the '3' to the number you expect. If the number of columns will change over time you can use a code like the following in the 'Advanced Editor'...
let
getMaxColumnSize = List.Max(List.Transform(Csv.Document(File.Contents("C:\pathToFile\TESTFILE.csv"),1, ",", ExtraValues.List)[Column1], each List.Count(_))),
Source = Csv.Document(File.Contents("C:\pathToFile\TESTFILE.csv"),getMaxColumnSize, ",")
in
Source
Proud to be a Super User! | |