Skip to contents

sp_upload() and sp_download() wrap the $upload_file() and $download_file() methods from the Microsoft365R::ms_drive object. In addition, sp_upload() checks for the existence of the destination folder and will prompt the user to create it if it doesn't exist.

Usage

sp_upload(src, dest = basename(src), site = NULL, drive = NULL)

sp_download(
  src,
  dest = basename(src),
  site = NULL,
  drive = NULL,
  overwrite = FALSE
)

Arguments

src

Location of source file. Either a local path (for sp_upload), or a Sharepoint path (for sp_download)

dest

Location of destination file. If not provided, uses the same file name as src

site

Site identifier. Can be the site name, id, URL, or an ms_site object. If no site identifier is provided, uses the stored default site if it exists.

drive

Drive identifier. Can be the drive name, id, or an ms_drive object. If site is provided but drive is not, uses the first drive of the provided site. If neither is provided, uses the stored default drive if it exists.

overwrite

Should the destination file be overwritten if it exists?

Value

Returns dest invisibly

See also

sp_read(), sp_write(); $upload_file() and $download_file() from Microsoft365R::ms_drive

Examples

if (FALSE) { # interactive()

# Set site defaults
sp_defaults("Data Analytics")

# List files
sp_list()

# Download a document locally
sp_download("Analysis Tools.docx", "AT.docx")

# Upload a document
sp_upload("AT.docx", "Analysis Tools.docx")
}