使用team\u drive\u get访问team drive上的文件

使用team\u drive\u get访问team drive上的文件,r,R,我已经成功地使用googledrive功能在我自己的googledrive上访问xlsx电子表格-所以 drive_download(file = "DIRECTOR_TM/Faculty/Faculty Productivity/Faculty productivity.xlsx", overwrite=TRUE) 工作并保存文件的本地副本,以供我运行分析 年中,我们转而使用团队驱动和类似的方法 drive_download(file = "Director/Faculty/Facu

我已经成功地使用googledrive功能在我自己的googledrive上访问xlsx电子表格-所以

drive_download(file = "DIRECTOR_TM/Faculty/Faculty Productivity/Faculty productivity.xlsx", 
   overwrite=TRUE)
工作并保存文件的本地副本,以供我运行分析

年中,我们转而使用团队驱动和类似的方法

drive_download(file = "Director/Faculty/Faculty Productivity/Faculty productivity.xlsx", 
   overwrite=TRUE)
不工作-我收到一个错误,上面写着“error:'file'未标识至少一个驱动器文件。”

所以我试着使用team\u drive\u get函数,但我感到困惑

Director <- team_drive_get("Director")

Director
googledrive
使用ID为您的团队识别扁平文件结构中的对象,也就是说,您不需要知道子目录。如果你知道你的文件名,你只需要搜索团队驱动并找到ID(请参阅你的具体问题——以及我为什么找到这个——如下所述)

#环境变量
文件名
TeamDrive <- team_drive_get("Director/Faculty/Faculty Productivity/")
# environment variables
FILENAME <- "your_file_name" 
TEAM_DRIVE_NAME <- "your_team_name_here"

# get file(s)
gdrive_files_df <- drive_find(team_drive = TEAM_DRIVE_NAME)
drive_download(
    as_id(gdrive_files_df[gdrive_files_df$name == FILENAME,]$id),
    overwrite = TRUE
)
# environment variables
FILEPATH <- "your_file_path"
TEAM_SUBDIRECTORY <- "your_subdirectory"

# grab the ID of your subdirectory and upload to that directory
drive_upload(
    FILEPATH,
    path = as_id(gdrive_files_df[gdrive_files_df$name == TEAM_SUBDIRECTORY,]$id), 
    name = FILENAME,
)