2 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Power Query - How to merge multiple sheets through common ID without invoking them in separate files?

I made a post previously but I omited too much so I could not make use of help, my apologies.

I have a machine which outputs excel file with information stored in following manner:
* n number of sheets with information about specific material per property (varies between 2-4 so far), with first sheet always being useless to me (always called "Details")

within the sheet:
* row with sheet name
* row of column names
* row of units (accidentally omitted)
* data (majority omited for lack of need)

Each sheet column names are almost the same but carry differnet information (e.g. "Enthalpy" or "Peak Temperature" are not the same; "File Name" and "Name" are the only true same between the sheets.)

Problem I encountered is that sometimes the machine outputs file names in different order between sheets, and occasionally I will have information only on one of the sheets.

All as shown below.

https://preview.redd.it/fklawxoeho3h1.png?width=610&format=png&auto=webp&s=b293fc4c10635b3425f4c3492778f7ca67272aa8

For when they were in correct order I used the script below.

I want to edit it to account for those misplacements, which cannot be through formula in native excel because I pull it into different excel file. I tried doing so through table.combine (no can, merges false same columns), and through Table.NestedJoin (can only merge one by one, which is both a hustle and if I change the number of sheets in the future it will break).
Is there a way to append any number of all of them at once through file name only?

Source = ...
#"Filtered table" = Table.ReplaceValue(Source, each [Data], each Table.Skip(Table.PromoteHeaders(Table.Skip([Data],1)),1), Replacer.ReplaceValue, {"Data"}),

#"Filtered Rows" = Table.SelectRows(#"Filtered table", each [Name] <> "Details"),

pref = Table.CombineColumns( #"Filtered Rows" , {"Name", "Data"}, (x) => Table.ToColumns(Table.DemoteHeaders( Table.PrefixColumns(x{1}, x{0}))), "data"),

#"Change headers"= Table.PromoteHeaders( Table.FromColumns(List.Combine(pref[data]) )),

#"Removed Other Columns" = Table.SelectColumns(#"Change headers",{"Glass transition.File Name", "Glass transition.Midpoint", "Hc.Enthalpy (normalized)", "Hc.Peak temperature", "Peak Integration (enthalpy).Enthalpy (normalized)", "Peak Integration (enthalpy).Peak temperature"}),

#"Split Column by Delimiter" = Table.SplitColumn(#"Removed Other Columns", "Glass transition.File Name", Splitter.SplitTextByEachDelimiter({"_"}, QuoteStyle.Csv, true), {"Material", "Run"}),

in

#"Split Column by Delimiter"

submitted by /u/3and12characters
[link] [comments]

Want to read more?

Check out the full article on the original site

View original article

Tagged with

#Excel alternatives for data analysis
#generative AI for data analysis
#no-code spreadsheet solutions
#big data management in spreadsheets
#conversational data analysis
#real-time data collaboration
#intelligent data visualization
#data visualization tools
#enterprise data management
#big data performance
#data analysis tools
#data cleaning solutions
#google sheets
#Excel compatibility
#financial modeling with spreadsheets
#Excel alternatives
#rows.com
#natural language processing for spreadsheets
#row zero
#machine learning in spreadsheet applications