Forum Discussion
Changing Excel sheet name in Power Query
- 4 years ago
MichaelF1 The code change needed is to the Transform File function.
It should look similar to this:
This is where you can modify it as Vijay_A_Verma helpfully suggested.
You need not change previous ones's names. Look here, I am merging few Excel workbooks in a folder where sheets are named either Sheet1 or Sheet2. So, you will need to change Transform Sample File code with a try statement. Replace Sheet1 and Sheet2 appropriately.
let
Source = Excel.Workbook(Parameter1, null, true),
Sheet1_Sheet = try Source{[Item="Sheet1",Kind="Sheet"]}[Data] otherwise Source{[Item="Sheet2",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true])
in
#"Promoted Headers"
- MichaelF14 years agoHelper III
Hi Vijay_A_Verma , thanks for the reply.
I'm confused becuse my source is a folder, not a workbook...
let Source = Folder.Files("S:\file_path\sales_orderdate"), etcThanks again,
Michael
- Vijay_A_Verma4 years agoMost Valuable Professional
Look on left side and you will find Transform Sample File, you will need to make this change there. See the pic below
- AlexisOlson4 years agoSuper User
MichaelF1 The code change needed is to the Transform File function.
It should look similar to this:
This is where you can modify it as Vijay_A_Verma helpfully suggested.