Benjamin Altman
Active Member
Members
Forum Posts: 4
Member Since:
March 20, 2024
March 20, 2024
Offline
I am combining reports located in a folder that all have the same structure. I use Get Data > From File > From Folder in Excel 365. I thought it was working perfectly but noticed that only the first 255 rows of each file are considered and if the workbook has less than 255 rows, it will pad the result with blank rows so each combined file has 255 rows in the sheet it combines them to. I need it add all the rows in each workbook without padding rows or stopping at 255.
There are queries, the part that transforms each file (Transform Sample File) and the part that acts on the final result (Other Queries [1]).
Transform Sample File:
let Source = Excel.Workbook(Parameter1, null, true), sheet2 = Source{[Name="sheet1"]}[Data], #"Removed Top Rows" = Table.Skip(sheet2,1), #"Promoted Headers" = Table.PromoteHeaders(#"Removed Top Rows", [PromoteAllScalars=true]) in #"Promoted Headers"
Other Queries [1]
let sourcePath = Excel.CurrentWorkbook(){[Name="DataSourceTable"]}[Content][DataSource]{0}, reportsPath = Excel.CurrentWorkbook(){[Name="DataSourceTable"]}[Content][DataSource]{1}, fullPath = Text.Combine({sourcePath, reportsPath}, "\"), Source = Folder.Files(fullPath), #"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"))), #"Removed Columns" = Table.RemoveColumns(#"Expanded Table Column1",{"Source.Name"}), #"Removed Blank Rows" = Table.SelectRows(#"Removed Columns", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null}))) in #"Removed Blank Rows"
I added in the "Removed Blank Rows" line before I realized it was artificially padding workbooks that were less than 255 rows. I also found a post here that mentions adding "[InferSheetDimensions = true]" to make Power Query "read the sheet dimension, not one which is metadata", but I couldn't work out how to add it without getting errors.
Does anyone know what I can do to just combine all the rows without leaving out any or causing Power Query to add blank rows?
Thanks!
Riny van Eekelen
Örnsköldsvik, Sweden
Moderator
Members
Moderators
Moderators
Forum Posts: 1032
Member Since:
January 31, 2022
January 31, 2022
Online
Benjamin Altman
Active Member
Members
Forum Posts: 4
Member Since:
March 20, 2024
March 20, 2024
Offline
I overwrote the fields in 2 reports with junk, saved the files, and the import worked perfectly. Testing right now, if I open the original files and save them without changes and close them it also then works, but using the original files returns to the behavior I described. Unfortunately, I can't post the original files though. The files I am using are downloaded from PeopleSoft as .xls files so the format is older. I am not sure if that has anything to do with it. I wonder if there is a quick way to pre-convert all the files to make it work.
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Riny van Eekelen
Guest(s) 7
Currently Browsing this Page:
1 Guest(s)
1 Guest(s)
Top Posters:
Catalin Bombea: 1939
SunnyKow: 1432
Anders Sehlstedt: 919
Purfleet: 415
Frans Visser: 349
Hans Hallebeek: 339
David_Ng: 306
lea cohen: 248
Jessica Stewart: 219
A.Maurizio: 216
Newest Members:
Drew Smith
Michael Denton
Nick Pascal
David Webb
Johannes Bruentrup
John Jay
Larry Silverman
David Rousseau
Melinda Heidemann
Jose Fuentes
Forum Stats:
Groups: 3
Forums: 25
Topics: 7073
Posts: 30998
Member Stats:
Guest Posters: 49
Members: 34470
Moderators: 2
Admins: 3
Administrators: Mynda Treacy, Philip Treacy, Jessica
Moderators: Velouria, Riny van Eekelen
© Simple:Press —