2016-11-07 55 views
0

我有一個用R編寫的自動化Excel報告生成系統,我希望該系統能夠在完成後將自動報告上傳到分享點。我寧願將上傳步驟寫入R.有沒有辦法做到這一點?通過R將文件上傳到分享點

謝謝

回答

1

我從來沒有聽說過使用R加載文件到SharePoint。如果您已經在使用Excel,只需運行一個小的VBA腳本即可將文件加載到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