- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Power BI Desktop adds column to csv files upon refresh
Hi
I have a situation where Power BI Desktop adds an extra column upon refreshing the data. The scheduled refresh itself works great.
I have some R script in each file that looks like this:
write.csv(dataset, file="S:\[filename].csv")
When I edit the query it only shows "Name" and "Value" fields. The original csv file has 10+ columns.
When the refresh occurs I notice that an additional field is added to the beginning of my csv file. It seems to mock a row count.
For now I have to delete the files prior to doing a refresh, otherwise it will keep adding extra columns.
Has anyone else experienced this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your R-script causes that. Add and additional argument: row.names=FALSE to avoid it.
See here for example about further details: http://rprogramming.net/write-csv-in-r/
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the column names you need are fixed, then in the query editor, select all the columns you need and remove other columns. That way, any new unwanted additional columns (in subsequent refreshes) are automatically removed.
Regards,
Tarun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your R-script causes that. Add and additional argument: row.names=FALSE to avoid it.
See here for example about further details: http://rprogramming.net/write-csv-in-r/
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
01-22-2020 03:32 PM | |||
Anonymous
| 07-27-2022 07:08 PM | ||
07-17-2024 11:03 PM | |||
08-21-2024 06:40 AM | |||
10-10-2023 05:52 AM |
User | Count |
---|---|
84 | |
81 | |
52 | |
37 | |
36 |
User | Count |
---|---|
104 | |
85 | |
48 | |
43 | |
41 |