Dampfnudel
New member
- Joined
- Mar 8, 2021
- Messages
- 2
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- Office 365 E3
Hello, I am new here!
I need some help to write a Power Query Code (M)
My current code:
"Filepath" and "Importpath" are defined ranges in the Workbook where excel defines the path the workbook is located and what sub path the data is located.
"Sheet 2.1" is a defined range in the Workbook where excel defines what sheet that query needs.
13.11.2020_Umlagenausfall_FC20_BUD21_V06_ak.xlsx is a different name every "reporting cycle"
What I need is a M Code that allows to grab whater xlsx file is located in that "Importpath" filepath.
I do know that Power query allows to grab filepaths instead of files. But when I do that, excel creates dozens of "example/help queries" which I do not want. I want a clear M code.
I need some help to write a Power Query Code (M)
My current code:
Code:
let
Filepath = Excel.CurrentWorkbook(){[Name="Filepath"]}[Content]{0}[Column1],
Importpath = Excel.CurrentWorkbook(){[Name="Importpath"]}[Content]{0}[Column1],
Sheet = Excel.CurrentWorkbook(){[Name="Sheet 2.1"]}[Content]{0}[Column1],
Quelle = Excel.Workbook(File.Contents(Filepath & Importpath &"13.11.2020_Umlagenausfall_FC20_BUD21_V06_ak.xlsx"), null, true),
#"Choose Sheet" = Quelle{[Item=Sheet,Kind="Sheet"]}[Data],
.......
in
#"Neu angeordnete Spalten"
"Filepath" and "Importpath" are defined ranges in the Workbook where excel defines the path the workbook is located and what sub path the data is located.
"Sheet 2.1" is a defined range in the Workbook where excel defines what sheet that query needs.
13.11.2020_Umlagenausfall_FC20_BUD21_V06_ak.xlsx is a different name every "reporting cycle"
What I need is a M Code that allows to grab whater xlsx file is located in that "Importpath" filepath.
I do know that Power query allows to grab filepaths instead of files. But when I do that, excel creates dozens of "example/help queries" which I do not want. I want a clear M code.