Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
utkuacik
Frequent Visitor

variable sheet name

hi guys .

 

i am searching for the answer for long time but could not find any solution. i just created dynamic folder and excel file name in power query . bu i just want to make the sheet name also variable. i just wish to take the sheet name form an excel table also . Name of the table for the variable sheet name will be "TCE_sheet_name"  AND WİLL HAVE 1  Column with name "TCE_sheet_name".

 

so i just wish to make the value below as a variable , coming from a table. 

 

i will be looking forward for your kind replies 

 

best regards

 

 

 

let
Source = Excel.CurrentWorkbook(){[Name="Table55"]}[Content],  ////path to folder Which excel file located
link = Source{0}[Table55_column_name],             
GetFiles = Excel.Workbook(File.Contents(link & "test.xlsm")),         //// show sheets in excel file
TCE_Sheet = GetFiles{[Item="TCE_test_sheet",Kind="Sheet"]}[Data],  /// OPEN the sheet with name "TCE_test_sheet"
#"Promoted Headers" = Table.PromoteHeaders(TCE_Sheet, [PromoteAllScalars=true])
in
#"Promoted Headers"

1 REPLY 1
slorin
Super User
Super User

Hi

Something like this

 

...
GetFiles = Excel.Workbook(File.Contents(link & "test.xlsm")),
Sheet_name = Table.FirstValue(Excel.CurrentWorkbook(){[Name="TCE_sheet_name"]}[Content]),
TCE_Sheet = GetFiles{[Item=Sheet_name,Kind="Sheet"]}[Data],
...

 

Stéphane

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.