Forum Discussion
combining Excel files with dfferent columns
- 3 years ago
Hello - yes, this is possible. You would just change the portion of the script that removes columns to only remove those that have duplicates, not to remove the empty columns.
BEFORE
// Combine duplicate plan columns and generic columns into one list. ColumnNamesToRemove = List.Combine ( { DuplicatePlanColumns, GenericColumnNames } ), // -------------------------------------------------------- // Clean up the column names. // -------------------------------------------------------- // Remove specific columns from the source table. RemoveColumns = Table.RemoveColumns ( Source, ColumnNamesToRemove ),AFTER
// Combine duplicate plan columns and generic columns into one list. // ColumnNamesToRemove = List.Combine ( { DuplicatePlanColumns, GenericColumnNames } ), // -------------------------------------------------------- // Clean up the column names. // -------------------------------------------------------- // Remove specific columns from the source table. RemoveColumns = Table.RemoveColumns ( Source, DuplicatePlanColumns),
jennratten , thanks! Very interesting approach. However, I would like to include all other columns as well - so practically column 9,10 and 11 belonging to the second file should be there in the final combination of files with null columns for the first file.
Is this at all possible?
Thanks again!
Kind regards
Valeria
Hello - yes, this is possible. You would just change the portion of the script that removes columns to only remove those that have duplicates, not to remove the empty columns.
BEFORE
// Combine duplicate plan columns and generic columns into one list.
ColumnNamesToRemove = List.Combine ( { DuplicatePlanColumns, GenericColumnNames } ),
// --------------------------------------------------------
// Clean up the column names.
// --------------------------------------------------------
// Remove specific columns from the source table.
RemoveColumns = Table.RemoveColumns ( Source, ColumnNamesToRemove ),
AFTER
// Combine duplicate plan columns and generic columns into one list.
// ColumnNamesToRemove = List.Combine ( { DuplicatePlanColumns, GenericColumnNames } ),
// --------------------------------------------------------
// Clean up the column names.
// --------------------------------------------------------
// Remove specific columns from the source table.
RemoveColumns = Table.RemoveColumns ( Source, DuplicatePlanColumns),- ValeriaBreve3 years agoPost Partisan
jennratten thanks! I am still testing and testing, I can't just get it to work yet as I want but I see the logic - so it's just a matter of keeping trying from my side 🙂
Thanks! 🙂