Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
vicente-iii
Helper I
Helper I

Automate the Export of Dataset from Power BI Service to OneDrive

Hi all

 

I need to export a dataset as a csv or xlsx file to One Drive upon a scheduled refresh from Power BI Service. I have made an R code which allows me to do this on Power BI Desktop but I am having a lot of issues doing the same thing on Power BI Server.

 

This is the R code I have used:

require(gdata)

write.csv(trim(dataset), file = "filepath/dataset.csv", row.names = F)

plot(dataset)

 

This is the error message I am getting from Power BI Service:

In file(file, ifelse(append, "a", "w")) : cannot open the connection. In addition: Warning message: In file(file, ifelse(append, "a", "w")) : cannot open file "filepath/dataset.csv": Permission denied

 

I was thinking that I need to change the filepath to a path that can find One Drive online rather than on my local disk ie. 

 

But it is still errors for both Power BI Desktop and Service with the following error message:

can only open URLs for readingError in file(file, ifelse(append, "a", "w")) : cannot open the connection Calls: write.table -> file Execution halted

 

Any ideas on how to solve this? Thank you

1 REPLY 1
Seth_C_Bauer
Community Champion
Community Champion

@vicente-iii Unfortunetly, I am not aware of any write back mechanisms that work in an automated fashion from Power BI. This is likely why the error states read only. Additionally, I don't know of any place where you can extract or see the refresh schedule, which is why you are likely going down this path. 


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.