googleplex101 googleplex101 - 10 months ago 110
R Question

Uploading file to sharepoint through R

I have an automated excel report generation system written in R and I would like that system to upload the automated reports to sharepoint once they are complete. I would prefer to have the upload steps written in R. Is there any way to do this?


Answer Source

I have never heard of using R to load files into SharePoint. If you are already using Excel, just run a small VBA script to load the files into SharePoint.

Dim SharepointAddress As String
Dim LocalAddress As String
Dim objNet As Object
Dim FS As Object

' Where you will enter Sharepoint location path
SharepointAddress = "\\sharepoint path to document library"  & "\" 
 ' Where you will enter the file path, ex: Excel file
LocalAddress = "your file path"                                     
Set objNet = CreateObject("WScript.Network")
Set FS = CreateObject("Scripting.FileSystemObject")
If FS.FileExists(LocalAddress) Then
FS.CopyFile LocalAddress, SharepointAddress
End If
Set objNet = Nothing
Set FS = Nothing