title: Uploading files to SharePoint from R
body: <p>I am trying to upload a file from R to SharePoint. I have found similar questions like <a href="https://stackoverflow.com/questions/45948534/saving-files-to-sharepoint-folder-from-r">Saving files to SharePoint folder from R</a>, <a href="https://stackoverflow.com/questions/41895673/saving-a-file-to-sharepoint-with-r?noredirect=1&amp;lq=1">Saving a file to Sharepoint with R</a> and <a href="https://stackoverflow.com/questions/15799268/copying-file-to-sharepoint-library-in-r?noredirect=1&amp;lq=1">Copying file to sharepoint library in R</a> but I haven't been able to get it working for myself.</p>
  
  <p>The things I tried so far:</p>
  
  <pre><code>system("curl --ntlm --user username:password --upload-file file.xslx https://companyname.sharepoint.com/sites/sitename/Shared%20documents/file.xlsx")
  
  system("curl --ntlm --user username:password --upload-file file.xslx https://companyname.sharepoint.com/sites/sitename/Documents/file.xlsx")
  
  system("curl --ntlm --user username:password --upload-file file.xslx https://companyname.sharepoint.com/sites/sitename/Shared documents/file.xlsx")
  
  system("curl --ntlm --user username:password --upload-file file.xslx \\\\companyname.sharepoint.com@SSL\\sites\\sitename\\Shared%20documents\\file.xlsx")
  </code></pre>
  
  <p>Note that our SharePoint is in our native language (Dutch), so the folder "Shared documents" is "Gedeelde documenten". I tried both languages but without success. Not sure if I am supposed to the English names or the Dutch ones.</p>
  
  <p>My guess is that the url I use is not in the correct format or such, so I have played around with that but can't come up with the correct way myself.
  Any help is much appreciated.</p>
  
  <p>EDIT:</p>
  
  <p>This is how the page and folder in Sharepoint looks like.
  Full url (guessed the part from /Forms till the end is not needed in the command): <a href="https://companyname.sharepoint.com/sites/SiteName/Gedeelde%20documenten/Forms/AllItems.aspx?id=%2Fsites%2FOfficeSFMT%2FGedeelde%20documenten%2FGeneral%2FTest" rel="nofollow noreferrer">https://companyname.sharepoint.com/sites/SiteName/Gedeelde%20documenten/Forms/AllItems.aspx?id=%2Fsites%2FOfficeSFMT%2FGedeelde%20documenten%2FGeneral%2FTest</a></p>
  
  <p>Screenshot of the folder: <a href="https://i.stack.imgur.com/RTiCu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RTiCu.png" alt="foldernames"></a></p>
  
  <p>My best guess was trying: <code>"--upload-file C:/Users/UserName/Documents/Test.txt",        "companyname.sharepoint.com/sites/SiteName/Documenten/General/Test/Test.txt"</code></p>