I would like to be able to pull files out of my project's Sharepoint directly with R to avoid needing to manually download many files repeatedly. Is there a way to do this? I've tried methods like:
library(readxl)
read_excel("https://company.sharepoint.com/sites/Project/Shared Documents/Folder/document.xlsx", "Sheet1")
library(downloader)
download(url = "https://company.sharepoint.com/sites/Project/Shared Documents/Folder/document.txt", destfile = "localfile.txt")
webpage <- getURL("https://company.sharepoint.com/sites/Project/Shared Documents/Folder/document.txt", userpwd = "username:password")
tc <- textConnection(webpage)
readLines(tc)
These all result in some form of Error 400, file not found, etc. I've looked into using the REST api with httr as well but haven't gotten anything but failure to receive handshake so far. I know the URL I'm using at least points to the right file because it works when pasted into a browser. I'm not sure if what I'm trying is incorrect or incorrectly formatted or even possible, honestly. Any help is appreciated.