Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Combine files with extra top row before column name

I want to import all excel files from a folder and combine them. These files have a top row that needs to be set as column name. But there are some files that have extra first row before column name ...
  • v-yingjl's avatar
    5 years ago

    Hi Anonymous ,

    If the row just in the sheet not in the table, you can connect to this table separately first.

     

    Then connect to the folder to filter without the 'problem' excel file to combine them and remove uncessary columns.

    remove the name column

     

    Finally append the previous table and the combined table to get the final combined table:

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • Anonymous's avatar
    Anonymous
    5 years ago

    I'm assuming you have a column of tables (not binary), and that the tables without the extra top row already have the correct column names. This means the other tables will have columns named "Column1, Column2", etc. Before combining, add this step in the formula bar:

    = Table.TransformColumns(NameOfPriorStep, {{"NameOfTableColumn", each if Table.ColumnNames(_){0} = "Column1" then Table.SkipFirstN(_, 1) else Table.DemoteHeaders(_)}})

    Now all of your headers should be in the first row. You can now combine and PromoteHeaders. 
    --Nate