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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Exporting file to sharepoint using R script editor

I have found a way to write to a file using R script editor in PowerBI. But the file directory is located on my hard drive. I'm trying to get it to write to a file that is located in Sharepoint. I'm not familiar with R coding, I used the code located in a tutorial.

require(gdata)
write.table(system(trim(dataset), file="(directory)", sep = "\t", row.names = FALSE))
plot(dataset);

Instead of '(directory)' I would include the URL which includes the directory to the folder in Sharepoint. However, it doesn't work.

I appreciate any help!

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

The last part of the code "upload-file C:/Users/Isra/Documents/pick.txt https://company.sharepoint.com/sites/wm/Folderdirectory.aspx"may be modified compares to the code in this thread.

 

As this issue is more related to R code, I would suggest you post here as I suggested before. 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-qiuyu-msft
Community Support
Community Support

Hi @Anonymous,

 

You can refer to this same thread: https://stackoverflow.com/questions/45948534/saving-files-to-sharepoint-folder-from-r

 

If you have further question about write R script, please post a thread here

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

So I used this code:

require(gdata)
system("curl --ntlm --user username:password--upload-file C:/Users/Isra/Documents/pick.txt https://company.sharepoint.com/sites/wm/Folderdirectory.aspx")
plot(dataset);

 And it ran because it plotted the dataset, however I can't see the file uploaded into the folder. Is there a mistake or a way I can see how the code ran?

Did you found the solution on how to automaticaly export an csv to a Sharepoint folder usin R script? 

Hi @Anonymous,

 

The last part of the code "upload-file C:/Users/Isra/Documents/pick.txt https://company.sharepoint.com/sites/wm/Folderdirectory.aspx"may be modified compares to the code in this thread.

 

As this issue is more related to R code, I would suggest you post here as I suggested before. 

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

did it work for you , if so please do post the code that you have used . Even I have a requirement where I need to export PBI Data set to Share point folder using R

Hello could you please help me find a way to do the automatic CSV extraction to sharepoint?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors