Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi,
I'm having trouble finding out how to extract data from a csv with multiple rows of fields.
After hours of googling and trying, I give up and hope the community has a solution.
Possibly I might overlook something completely?
Source file is an exported .csv that looks like this:
I tried to get the .csv in Excel and directly in PowerQuery.
I'm no rockstar with this kind of data files, but I hope to find a way to get all fields in separate columns and only a 1 line record
Solved! Go to Solution.
I think this one is better to handle a bit more manually than working with the built-in CSV function.
What I did was load in every line using Lines.FromBinary, combine all the lines into one big string, then replace "#(lf);;" with just ";" so that the multiple lines that belong together are combined into one.
I loaded this big string into a single table cell and split that cell into rows using a double linefeed as the delimiter (this took care of the blank lines). Then I split the resulting rows into columns using a semicolon as the delimiter.
To finish up, I promoted the first row to be used as headers and set the column types using Detect Data Type.
let
Source = Folder.Files("C:\Users\aolson\Downloads"),
TextFile = Source{[#"Folder Path"="C:\Users\aolson\Downloads\",Name="facturen.txt"]}[Content],
#"Imported Text" = #table(1,{{Text.Replace(Text.Combine(Lines.FromBinary(TextFile,null,null,1252),"#(lf)"),"#(lf);;",";")}}),
#"Split Text Into Rows" = Table.ExpandListColumn(Table.TransformColumns(#"Imported Text", {{"Column1", Splitter.SplitTextByDelimiter("#(lf)#(lf)", QuoteStyle.Csv)}}), "Column1"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Split Text Into Rows", "Column1", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), 10),
#"Promoted Headers" = Table.PromoteHeaders(#"Split Column by Delimiter", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Fact.", Int64.Type}, {"Boekstuknr.", Int64.Type}, {"Deb.nr.", Int64.Type}, {"Debiteurnaam", type text}, {"Categorie", type text}, {"Factuurdatum", type date}, {"Vervaldatum", type date}, {"Bedrag excl. btw", type number}, {"Btw", type number}, {"Totaalbedrag", type number}})
in
#"Changed Type"
Hi @Syndicate_Admin ,
Is your problem solved? If so, would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirment will find the solution quickly and benefit here, thank you!
Best Regards,
Community Support Team _ kalyj
Hi,
I don't have any clue about the Lines.FromBinary (yet, good resources are welcome), but this m-code does what I was looking for.
I will need to replicate for other exports that come out of the system like this.
So, thnxs a million for setting me up: this will definitely help me learn forward too 🙂
I think this one is better to handle a bit more manually than working with the built-in CSV function.
What I did was load in every line using Lines.FromBinary, combine all the lines into one big string, then replace "#(lf);;" with just ";" so that the multiple lines that belong together are combined into one.
I loaded this big string into a single table cell and split that cell into rows using a double linefeed as the delimiter (this took care of the blank lines). Then I split the resulting rows into columns using a semicolon as the delimiter.
To finish up, I promoted the first row to be used as headers and set the column types using Detect Data Type.
let
Source = Folder.Files("C:\Users\aolson\Downloads"),
TextFile = Source{[#"Folder Path"="C:\Users\aolson\Downloads\",Name="facturen.txt"]}[Content],
#"Imported Text" = #table(1,{{Text.Replace(Text.Combine(Lines.FromBinary(TextFile,null,null,1252),"#(lf)"),"#(lf);;",";")}}),
#"Split Text Into Rows" = Table.ExpandListColumn(Table.TransformColumns(#"Imported Text", {{"Column1", Splitter.SplitTextByDelimiter("#(lf)#(lf)", QuoteStyle.Csv)}}), "Column1"),
#"Split Column by Delimiter" = Table.SplitColumn(#"Split Text Into Rows", "Column1", Splitter.SplitTextByDelimiter(";", QuoteStyle.Csv), 10),
#"Promoted Headers" = Table.PromoteHeaders(#"Split Column by Delimiter", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Fact.", Int64.Type}, {"Boekstuknr.", Int64.Type}, {"Deb.nr.", Int64.Type}, {"Debiteurnaam", type text}, {"Categorie", type text}, {"Factuurdatum", type date}, {"Vervaldatum", type date}, {"Bedrag excl. btw", type number}, {"Btw", type number}, {"Totaalbedrag", type number}})
in
#"Changed Type"
Hi,
can you post some data, not a screenshot?
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.