Hi
How would you adjust below code where :
• the source is based on a table so is dynamic.
• I want to force the loaded file (type is .prn) to be treated as text file rather than csv.
As is, I am running into "DataFormat.Error: There were more columns in the result than expected."
I've tried to combine with below snippet of code, but not sure how to combine:
I'm not sure how to apply the function to the first section of code
Many Thanks for any Assistance!!
How would you adjust below code where :
• the source is based on a table so is dynamic.
• I want to force the loaded file (type is .prn) to be treated as text file rather than csv.
As is, I am running into "DataFormat.Error: There were more columns in the result than expected."
Code:
[COLOR=#373737][FONT='inherit'][FONT=arial]let
DirectoryTable = Excel.CurrentWorkbook(){[Name="tbl_Directory"]}[Content],
DirectoryColumn = Table.Column(DirectoryTable , "Directory"),
DirectoryFirstValue = List.First(DirectoryColumn),
Source = Folder.Files(Text.From(DirectoryFirstValue )),
LoadBinaryAsTable = Table.AddColumn(Source, "Custom", each Csv.Document([Content])),[/FONT][/FONT][/COLOR]
[COLOR=#373737][FONT='inherit'][FONT=arial]#"Expanded Custom" = Table.ExpandTableColumn(LoadBinaryAsTable, "Custom", {"Column1"}, {"Custom.Column1"}),
[/FONT][/FONT][/COLOR]
I've tried to combine with below snippet of code, but not sure how to combine:
Code:
[COLOR=#373737][FONT=Georgia][I][FONT=arial]let
fnRawFileContents = (fullpath as text) as table =>
let
Value = Table.FromList(Lines.FromBinary(File.Contents(fullpath)),Splitter.SplitByNothing())
in Value,[/FONT][/I][/FONT][/COLOR]
[COLOR=#373737][FONT=Georgia][I][FONT=arial]Source = fnRawFileContents("C:\Test\ThisIsAnExample.CSV")[/FONT][/I][/FONT][/COLOR]
[COLOR=#373737][FONT=Georgia][I][FONT=arial]in
Source[/FONT][/I][/FONT][/COLOR]
I'm not sure how to apply the function to the first section of code
Many Thanks for any Assistance!!
Last edited: