Forum Discussion
Extracting multiple PDF files from a folder
You could always delete the sample query, and also delete the invocation of the sample creamery in your main file, which will give you just a list of the tables, which you can then select individually with another query and transform each separately.
--Nate
- PaulDBrown3 years agoCommunity Champion
Anonymous Thanks for the suggestion, but I'm not too sure what you mean. The source data is 34 PDF files with at least half a dozen pages each (where there are rows/text which I don't need mixed with data which I need to transform).
This is the interface I get when I select the folder connector. I need to select a "page" to access the sample file:
which leads to the following in the Transform file code:
= (Parameter1 as binary) => let Source = Pdf.Tables(Parameter1, [Implementation="1.3"]), Page001 = Source{[Id="Page001"]}[Data], #"Changed Type1" = Table.TransformColumnTypes(Page001,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}}), #"Changed Type" = Table.TransformColumnTypes(#"Changed Type1",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}}) in #"Changed Type"where the code is set to "page1". The final Query loading the data leads with this code:
Source = Folder.Files("D:\OneDrive - In2-Action.com\Biniarbolla\Informes MB\Estructura corta"), #"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true), #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content])), #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}), #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File"}), #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File", Table.ColumnNames(#"Transform File"(#"Sample File"))), #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}}),This only loads the first page for each file. How can I change it to load every page from each file?
Many thanks!
- Poohkrd3 years agoAdvocate I
Hi, Paul! Try this .pbix file like example.