Write an object to file and upload file to SharePoint
Source:R/write_sharepoint.R
write_sharepoint.Rdwrite_sharepoint() uses upload_sp_item() to upload an object created
using:
sf::write_sf()if x is ansfobjectreadr::write_csv()if x is adata.frameand file does not include a xlsx extensionopenxlsx2::write_xlsx()if x is adata.framefile does include a xlsx extensionThe
print()method from{officer}if x is ardocx,rpptx, orrxlsxobjectreadr::write_rds()if x is any other class
Usage
write_sharepoint(
x,
file,
dest,
...,
.f = NULL,
new_path = tempdir(),
overwrite = FALSE,
drive_name = NULL,
drive_id = NULL,
drive = NULL,
site_url = NULL,
site_name = NULL,
site_id = NULL,
site = NULL,
blocksize = 327680000,
call = caller_env()
)Arguments
- x
Object to write to file and upload to SharePoint.
sf,rdocx,rpptx,rxlsx, anddata.frameobjects are saved with the functions noted in the description. All other object types are saved asrdsoutputs.- file
File to write to. Passed to
fileparameter forreadr::write_csv()orreadr::write_rds(),dsnforsf::write_sf(), ortargetforprint()(when working with{officer}class objects).- dest
Destination on SharePoint for file to upload. SharePoint folder URLs are supported.
- ...
Additional parameters passed to write function.
- .f
Optional function to write the input data to disk before uploading file to SharePoint.
- new_path
Path to write file to. Defaults to
tempdir()- overwrite
If
FALSE(default), error if an item with the name specified infileorsrcalready exists at the specified destination. IfTRUE, overwrite any existing items with the same name. The latter is the default for theupload_filemethod.- drive_name, drive_id
SharePoint drive name or ID.
- drive
A
ms_driveobject. If drive is supplied,drive_name,site_url, and any additional parameters passed to...are ignored.- site_url
A SharePoint site URL in the format "https://[tenant name].sharepoint.com/sites/[site name]". Any SharePoint item or document URL can also be parsed to build a site URL using the tenant and site name included in the URL.
- site_name, site_id
Site name or ID of the SharePoint site as an alternative to the SharePoint site URL. Exactly one of
site_url,site_name, andsite_idmust be supplied.- site
A
ms_siteobject. Ifsiteis supplied,site_url,site_name, andsite_idare ignored.- blocksize
Additional parameter passed to
upload_folderorupload_filemethod forms_driveobjects.- call
The execution environment of a currently running function, e.g.
caller_env(). The function will be mentioned in error messages as the source of the error. See thecallargument ofabort()for more information.