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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
laurenm
Frequent Visitor

Write Excel to Sharepoint using R Script

Hi,

 

I'll preface this by saying I do not know any R script. I was looking for a way to automate exporting data from PowerBI to Excel (which I'll then try to automate to get emailed to a client) and came across the following simple logic -


    # 'dataset' holds the input data for this script
    install.packages("writexl")
    library("writexl")
    write_xlsx(dataset, "f:/Local Name/Test Folder/data_export.xlsx")

 

It works well and drops a file in the local folder. I do not have a personal gateway however so I can't schedule it in the PBI service. I wanted to try Sharepoint instead.
I have already seen the following article -

https://stackoverflow.com/questions/45948534/saving-files-to-sharepoint-folder-from-r

But, again, I know zero on R script so I don't know how the solution code is supposed to be formatted or fit into my little four line setup.

Any advice would be greatly appreciated.

1 REPLY 1
lbendlin
Super User
Super User

What's your rationale for attempting to do this in Power BI?  Have you considered using Power Automate instead, or Powershell?

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.