Import synced OneDrive files

Viewed 223

For a project I want to create a shinydashboard that is powered by data provided by various people in a SharePoint and has the ability to automatically update once a file is edited in SharePoint.

Because of firewall issues with the company I am working for it seemed like a better idea to sync the SharePoint folder to my local disk, and upload the files from there.

My code looks like this:

observe({
  invalidateLater(2000, session)
  list <- list.files(path = "../../folder/folder", pattern = ".xlsx", recursive = T)
  for (i in 1:length(list)) {
    assign(basename(file_path_sans_ext(list[i])), 
           as.data.table(read_xlsx(paste0("../../folder/folder/", list[i]))))
  }
})

By itself the code works well. It grabs all of the documents and assigns them to data.tables with their filename as name. However, whenever I make a change to one of the documents in SharePoint it won't update the file in my local disk until I open it manually. I can see that because when I the Preview Pane in file explorer it will still show the unedited document.

My question: Is there a way in R to force a sync or in OneDrive to sync automatically once an update is made to the original file? All files combined are like 250kb so even if an automatic update might be too heavy in most cases, I think it's fine in my case.

0 Answers
Related