Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I get a monthly excel file which is generated by another program and contains a table with a running number in the name.
Meaning, each file, contains a table with a different name (same structure).
When I want to import the folder into Power BI I get an error and I think it is due to the different names of the tables.
Please see the file and the folder zipped here
Thank you
Tamir
Solved! Go to Solution.
HI @Anonymous
in the query editor
copy and paste this code
do not forget to change the location of the folder where the files are.
let Fonte = Folder.Files("C:\Users\Desktop\Import folder"), #"Personalização Adicionada" = Table.AddColumn(Fonte, "Personalizar", each Excel.Workbook([Content])), #"Outras Colunas Removidas" = Table.SelectColumns(#"Personalização Adicionada",{"Personalizar", "Name"}), #"Personalizar Expandido" = Table.ExpandTableColumn(#"Outras Colunas Removidas", "Personalizar", {"Name", "Data", "Item", "Kind", "Hidden"}, {"Name.1", "Data", "Item", "Kind", "Hidden"}), #"Linhas Filtradas" = Table.SelectRows(#"Personalizar Expandido", each ([Kind] = "Table")), #"Outras Colunas Removidas1" = Table.SelectColumns(#"Linhas Filtradas",{"Name.1", "Data", "Name"}), #"Data Expandido" = Table.ExpandTableColumn(#"Outras Colunas Removidas1", "Data", {"Date", "Sales"}, {"Date", "Sales"}), #"Colunas Reordenadas" = Table.ReorderColumns(#"Data Expandido",{"Name", "Name.1", "Date", "Sales"}), #"Tipo Alterado" = Table.TransformColumnTypes(#"Colunas Reordenadas",{{"Name", type text}, {"Name.1", type text}, {"Date", type date}, {"Sales", type number}}) in #"Tipo Alterado"
HI @Anonymous
in the query editor
copy and paste this code
do not forget to change the location of the folder where the files are.
let Fonte = Folder.Files("C:\Users\Desktop\Import folder"), #"Personalização Adicionada" = Table.AddColumn(Fonte, "Personalizar", each Excel.Workbook([Content])), #"Outras Colunas Removidas" = Table.SelectColumns(#"Personalização Adicionada",{"Personalizar", "Name"}), #"Personalizar Expandido" = Table.ExpandTableColumn(#"Outras Colunas Removidas", "Personalizar", {"Name", "Data", "Item", "Kind", "Hidden"}, {"Name.1", "Data", "Item", "Kind", "Hidden"}), #"Linhas Filtradas" = Table.SelectRows(#"Personalizar Expandido", each ([Kind] = "Table")), #"Outras Colunas Removidas1" = Table.SelectColumns(#"Linhas Filtradas",{"Name.1", "Data", "Name"}), #"Data Expandido" = Table.ExpandTableColumn(#"Outras Colunas Removidas1", "Data", {"Date", "Sales"}, {"Date", "Sales"}), #"Colunas Reordenadas" = Table.ReorderColumns(#"Data Expandido",{"Name", "Name.1", "Date", "Sales"}), #"Tipo Alterado" = Table.TransformColumnTypes(#"Colunas Reordenadas",{{"Name", type text}, {"Name.1", type text}, {"Date", type date}, {"Sales", type number}}) in #"Tipo Alterado"
For anyone who wishes to use the code in its English version:
let Source = Folder.Files("C:\Users\user\OneDrive - Tamir Basin\Power BI\Import folder"), #"Invoke Custom Function1" = Table.AddColumn(Source, "CustomTamir", each Excel.Workbook([Content])), #"Removed Other Columns" = Table.SelectColumns(#"Invoke Custom Function1",{"CustomTamir", "Name"}), #"Expanded CustomTamir" = Table.ExpandTableColumn(#"Removed Other Columns", "CustomTamir", {"Name", "Data", "Item", "Kind", "Hidden"}, {"Name.1", "Data", "Item", "Kind", "Hidden"}), #"Filtered Rows" = Table.SelectRows(#"Expanded CustomTamir", each ([Kind] = "Table")), #"Removed Other Columns1" = Table.SelectColumns(#"Filtered Rows",{"Name.1", "Data", "Name"}), #"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns1", "Data", {"Date", "Sales"}, {"Date", "Sales"}), #"Changed Type" = Table.TransformColumnTypes(#"Expanded Data",{{"Name.1", type text}, {"Date", type date}, {"Sales", Int64.Type}, {"Name", type text}}), #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Name", "FileName"}, {"Name.1", "TableName"}}), #"Reordered Columns" = Table.ReorderColumns(#"Renamed Columns",{"Date", "FileName", "TableName", "Sales"}) in #"Reordered Columns"
hi @Anonymous
the commands of the M functions are always in English so you can use them without problems, only the names of the query steps can be changed.
example:
# "Expanded Data" =
# "Expanded data" =
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
76 | |
76 | |
55 | |
35 | |
34 |
User | Count |
---|---|
99 | |
56 | |
53 | |
44 | |
40 |