Forum Discussion

Giulianna's avatar
Giulianna
Icon for Helper I rankHelper I
1 year ago
Solved

Import multiple files from a folder that can be copied and used for different users

I am trying to create a tool for my team where the excel imports files from a folder which contains multiple tamplates and these templates are used to generate different queries, and with the queries...
  • PwerQueryKees's avatar
    1 year ago

    If you add one line to CurrentFile it should work:

    let
        Source = Excel.CurrentWorkbook(),
        MyFileName = Source{[Name="MyFileName"]}[Content],
        #"Renamed Columns" = Table.RenameColumns(MyFileName,{{"Column1", "Current File Name"}}),
        #"Extracted Text Before Delimiter" = Table.TransformColumns(#"Renamed Columns", {{"Current File Name", each Text.BeforeDelimiter(_, "["), type text}}),
        #"Current File Name" = #"Extracted Text Before Delimiter"{0}[Current File Name]
    in
        #"Current File Name"