Forum Discussion

EdgarPach's avatar
EdgarPach
New Member
6 years ago
Solved

Combine Files but leave columns

Hello to all,

 

I am gathering data from around 52,000 files, i have all the data on power query lodad:

  1. i need to combine the files to extract the data that i need from each file
  2. also i need the "Date Modified" column

BUT, when I use "combine files" (Image 2) all the other columns desapear, included "Date Modified",

How can i combine the files and leave the "Date Modified" column?

 

  • Hi EdgarPach 

    Create a duplicates of "New folder", then combine files in "New folder(2)", remove "content" column in "New folder".

    Then merge two table and expand columns

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

4 Replies

  • Modify the Power Query M code in the Advanced Editor to preserve your columns. Look for the Table.SelectColumns transform.

    • EdgarPach's avatar
      EdgarPach
      New Member

      Found it....!

       

      Know what? 🙂

       

      I am new at this

       

      let
      Source = Folder.Files("C:\Users\epacheco\OneDrive - Fresenius Medical Care\Desktop\Calibration"),
      #"Filtered Rows" = Table.SelectRows(Source, each Text.Contains([Name], "Config Sheet")),
      #"Filtered Hidden Files1" = Table.SelectRows(#"Filtered Rows", each [Attributes]?[Hidden]? <> true),
      #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File from Calibration (3)", each #"Transform File from Calibration (3)"([Content])),
      #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
      #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File from Calibration (3)"}),
      #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from Calibration (3)", Table.ColumnNames(#"Transform File from Calibration (3)"(#"Sample File (3)"))),
      #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Column1", type text}})
      in
      #"Changed Type"

      • lbendlin's avatar
        lbendlin
        Super User

        Add your Last Modified Date column back in at that step.