Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
What M code can we get sheet in the first order(most left sheet) no matthe what its name is?
Sheet name is dynamic so I shouldn't type in the code.
e.g. for this snapshot, it will be TOSS Serivce PO_Master cuz it is the most left(first)
Solved! Go to Solution.
Hi @Anonymous Try this way:
let
Source = Excel.Workbook(File.Contents("YourFilePath.xlsx"), null, true),
FirstSheet = Source{0}[Data]
in
FirstSheet
Just replace "YourFilePath.xlsx" with the path to your Excel file. This will dynamically get the data from the first sheet, no matter what its name is.
Also, your mentioned method would work.
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
I've tested as below and it seems it will stack in initial order unless put other filter to affect.
Then I can just take first row in Query.
If it is not correct pls guide me.
Hi @Anonymous Try this way:
let
Source = Excel.Workbook(File.Contents("YourFilePath.xlsx"), null, true),
FirstSheet = Source{0}[Data]
in
FirstSheet
Just replace "YourFilePath.xlsx" with the path to your Excel file. This will dynamically get the data from the first sheet, no matter what its name is.
Also, your mentioned method would work.
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |