Forum Discussion
How to add headers without columns elements?
- 1 year ago
Hi toplisek
1 Using "Use First Row as Headers"(what you're looking for)
- Make sure your first row in the data contains the header titles you want
- In the Home tab, click "Use First Row as Headers" (the table icon with 123 on it)
- This will promote your first data row to become column headers
2 Manual Renaming
- Right-click on a column header (e.g., "Column1")
- Select "Rename" from the context menu
- Type your desired header name
- Repeat this process for each column individually
3 Using the Created Step from First Rename
- First rename one column manually (this creates a step in the query)
- In the formula bar, modify the generated code to rename all columns at once
The formula should look like:
= Table.RenameColumns(PreviousStep, {{"Column1", "NewName1"}, {"Column2", "NewName2"}, {"Column3", "NewName3"}})
4 Inserting a New Step Before Renaming
- Go to the "Add Step" button or right-click in the query steps pane
- Insert a new custom step
- Use the complete rename formula for all columns:
= Table.RenameColumns(Source, {{"Column1", "Header1"}, {"Column2", "Header2"}, {"Column3", "Header3"}})
Note: Replace "Source" with the name of your previous step if needed, and adjust the column names and new headers according to your data.
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it!
Thank you.
- 1 year ago
Hey toplisek ,
To add headers from the first row of a CSV file in Power Query Editor especially when it's currently using default column names like Column1, Column2, etc.
Steps to Use First Row as Headers
Open Power Query Editor (as shown in your screenshot).
On the Home tab, locate the Transform section.
Click on “Use First Row as Headers”.
This option will promote the first row of your data to become the column headers.
It is labeled: Use First Row as Headers (right beside the "Data Type: Text" and “Replace Values” buttons).
Shortcut: It corresponds to this M code:
Table.PromoteHeaders(Source, [PromoteAllScalars=true])
If "Use First Row as Headers" is Disabled or Missing
You may already have applied it once. In that case:
Click on “Advanced Editor” and remove or adjust the previous steps.
You can manually promote headers using this line in the Advanced Editor:
#"Promoted Headers" = Table.PromoteHeaders(PreviousStepName, [PromoteAllScalars=true])
Cleanup Steps
After promoting headers:
You might still see rows with old header names like Column1, Column2.
Use the “Remove Rows” → “Remove Top Rows” option to delete the top row (if needed).
Rename any column manually by double-clicking the column name or using the “Transform → Rename” option.
If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.
Best Regards,
Nasif Azam
Hi toplisek ,
If you want to add headers to your CSV file in Power Query and you see generic names like Column1, Column2, etc., you can manually set the headers using the "Use First Row as Headers" function (you find it on the Home tab in Power Query). If your CSV doesn't actually have a header row, you can rename the columns one by one:
- Right-click each column name (like Column1) and pick "Rename" — then just type whatever header you want.
- Or, if you have a fixed list, you can use the Power Query formula bar with something like:
= Table.RenameColumns(Source, {{"Column1", "YourHeader1"}, {"Column2", "YourHeader2"}})Just swap YourHeader1/2 with the names you need.
If you have a lot of columns, let me know, there are ways to automate this too!
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI