• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Displaying Query name in append field in Power Query Excel

Prajnan ks

New Member
Displaying Query name in append field in Power Query Excel
Enclosed Sample excel file make append all 3 queries like April,may & June along with Query Name to be displayed
 

Attachments

  • Sample File_appendalong with name.xlsx
    182.9 KB · Views: 10
Prajnan ks
You've one time noted this:
You have opened Your thread in Ask an Excel Question.
... Your thread's Title gives image that You're asking something about
Power Query.
Please, open thread in correct Forum ( now, this has moved there )
... as written in Forum Rules, which You should reread soon.

Did You reread Forum Rules?
 
In the Advanced PQ Editor you'd add a line such as this:
Code:
#"Added Custom" = Table.AddColumn(#"Previous Step", "Query Name", each "MyQueryName")
where the new column's name will be "Query Name" and all rows will contain the literal MyQueryName.
In the GUI (not Advanced Editor) you'd add a Custom Column like:
80226
Do that with all the queries you want, then when it comes to merging or appending you'll have one column containing the query source.

I can't do anything with your attachment which is blank because all the queries don't have access to 'C:\Users\pks2\OneDrive - Reckitt\Desktop\Others\Misc\Append\April2022.xlsx'
 
So your root is:
'C:\Users\pks2\OneDrive - Reckitt\Desktop\Others\Misc\Append\

So I would:
- Data -> From File -> From folder
- The column [Name] will be the source
- Add a column Excel.Workbook([Content]) to read the excel content and have it in a table object
- expand and apply your original steps
 
In the Advanced PQ Editor you'd add a line such as this:
Code:
#"Added Custom" = Table.AddColumn(#"Previous Step", "Query Name", each "MyQueryName")
where the new column's name will be "Query Name" and all rows will contain the literal MyQueryName.
In the GUI (not Advanced Editor) you'd add a Custom Column like:
View attachment 80226
Do that with all the queries you want, then when it comes to merging or appending you'll have one column containing the query source.

I can't do anything with your attachment which is blank because all the queries don't have access to 'C:\Users\pks2\OneDrive - Reckitt\Desktop\Others\Misc\Append\April2022.xlsx'
Hi,
I am unable to understand please find link to solve the same.


T&R
Prajnan.k.s
 
In the attached file called Sample File_appendalong with nameFiles I have manually added a column to each of your queries (as I suggested in msg#3). I have kept the name of your folder so with a bit of luck it should run without adjustment.
This will be hard work because you'll have to add queries for every file you want to process and alter the Append1 query each time your data source file names change.

It should be easier for you to use the file called Sample File_appendalong with nameFolder which will look at all the excel files in your folder C:\Users\pks2\OneDrive - Reckitt\Desktop\Others\Misc\Append\ . This means that you should NOT save this workbook into the same folder, but somewhere else. When refreshing the table in this workbook it will look for all Excel files in your folder, so you should only have the files you want to extract data from in that folder before you refresh. With luck, it too will run out of the box.
 

Attachments

  • Sample File_appendalong with nameFiles.xlsx
    222.7 KB · Views: 7
  • Sample File_appendalong with nameFolder.xlsx
    18.8 KB · Views: 4
In the attached file called Sample File_appendalong with nameFiles I have manually added a column to each of your queries (as I suggested in msg#3). I have kept the name of your folder so with a bit of luck it should run without adjustment.
This will be hard work because you'll have to add queries for every file you want to process and alter the Append1 query each time your data source file names change.

It should be easier for you to use the file called Sample File_appendalong with nameFolder which will look at all the excel files in your folder C:\Users\pks2\OneDrive - Reckitt\Desktop\Others\Misc\Append\ . This means that you should NOT save this workbook into the same folder, but somewhere else. When refreshing the table in this workbook it will look for all Excel files in your folder, so you should only have the files you want to extract data from in that folder before you refresh. With luck, it too will run out of the box.
Ok then please suggest me to input our own text in append query
 
Back
Top