Using a source file object, this function returns the file connection object. m365filer has file connection objects built for cloud files in the cloud_file object. This object is abstracted to sharepoint files and onedrive files, both of which sit on the ms_drive object from the Microsoft365R package.

get_file_connection(file, drive = NULL)

Arguments

file

A source file object

drive

An ms_drive object

Value

A cloud_file object or file path

Details

These objects are built on top of file connections, which allows you to interface with files much the same as a local file, by simply providing to the file parameter of reader or writer functions. Files are read or written directly to the cloud, and temporary files that clean up with your R sessions are leveraged to minimize the amount of interface that your local device has to do with the cloud

Examples

if (FALSE) {
x <- source_file("Documents/test.csv", "onedrive")

mtcars %>% write.csv(get_file_connection(x))

y <- read.csv(get_file_connection(x))
}