Forum Discussion
How to edit sheet name in Excel doc when source is a folder
- 4 years ago
Hi, MichaelF1
I probably understand what you mean, but you may need to change your thought and try to use dynamic data sources by using different dates in table names.
You can refer to it first:
Solved: Dynamic Excel name handling in Power BI - Microsoft Power BI Community
Solved: Re: 2 Parameters - Microsoft Power BI Community
Then if you have any specific questions, please feel free to ask me.
Best Regards,
Community Support Team _ JaneyIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi MichaelF1
It's been a long time since you queried this issue but I've experienced the same issue and couldn't find any satisfying solution in forums until I consulted ChatGPT 🙂 I wanted to change the sheet name in Excel from "Billing details_C2S2" to "Billing details". Here's it's answer that perfectly solved my issue:
From the M code you provided, it looks like the sheet name is not explicitly referenced because you are using a folder query (Folder.Files), which transforms multiple files in the folder, and the transformation is done via a custom function (Transform File (11)).
The problem likely stems from the step where this custom function is called. Since you renamed the sheet inside the Excel file, the function "Transform File (11)" might still expect the original sheet name, "Billing details_C2S2", leading to the error.
Here’s what you can do to fix it:
Steps to Edit the Custom Function:
- In Power Query Editor, go to the Queries pane on the left and locate the query named "Transform File (11)" (this is the custom function).
- Click on this function to view its steps.
- Inside this function, find where it refers to the sheet name "Billing details_C2S2".
- Update this reference to "Billing details" (the new sheet name).
- Apply the changes and re-run the query.