Forum Discussion
Darko_Giac
7 years agoHelper II
Importing Update Files from Folder Without Changing Sheet Name
Hi all, I'm currently working in Power Query and am exporting some survey data on a weekly basis to track the number of participants over the next month. The variables in the export will not...
- 7 years ago
Hi Darko_Giac,
I would suggest we only change the necessary parts and leave the Power BI to generate other codes. The first line of your code can't run. It could be like below.
let Source = Folder.Files("D:\pbi_folder1"), #"D:\pbi_folder1\_ds xlsx" = Source{[#"Folder Path"="D:\pbi_folder1\",Name="ds.xlsx"]}[Content], #"Imported Excel" = Excel.Workbook(#"D:\pbi_folder1\_ds xlsx"), #"Added Index" = Table.AddIndexColumn(#"Imported Excel", "Index", 0, 1), Sheet1_Sheet = #"Added Index"{[Index=0,Kind="Sheet"]}[Data] in Sheet1_SheetBest Regards,
Dale
Darko_Giac
7 years agoHelper II
Thanks for the response Dale!
I'm still having some issues getting this to work though. I noticed your solution was pulling from a workbook, but I would need to pull from a folder.
I'm trying to get the query below to work:
let
Source = Folder.Files(File.Contents("C:\PowerTracking\PracticeFolder), null, true),
#"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1),
Sheet1_Sheet = #"Added Index"{[Index=0,Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Response ID", type text}})
in
#"Changed Type"But running into the error:
Expression.SyntaxError: Token Comma expected (afterwhich it highlights the third line (#"Added Index")
v-jiascu-msft
7 years agoMicrosoft Employee
Hi Darko_Giac,
I would suggest we only change the necessary parts and leave the Power BI to generate other codes. The first line of your code can't run. It could be like below.
let
Source = Folder.Files("D:\pbi_folder1"),
#"D:\pbi_folder1\_ds xlsx" = Source{[#"Folder Path"="D:\pbi_folder1\",Name="ds.xlsx"]}[Content],
#"Imported Excel" = Excel.Workbook(#"D:\pbi_folder1\_ds xlsx"),
#"Added Index" = Table.AddIndexColumn(#"Imported Excel", "Index", 0, 1),
Sheet1_Sheet = #"Added Index"{[Index=0,Kind="Sheet"]}[Data]
in
Sheet1_Sheet
Best Regards,
Dale
