简体   繁体   English

识别来自云端的xlsx文件列表(Google驱动器)

[英]Identifying list of xlsx files from the cloud (google drive)

I am trying to create a loop where I can perform the same set of functions for a bunch of files. 我试图创建一个循环,在其中可以对一堆文件执行相同的功能集。 However, the files are stored on a shared folder in google drive (xlsx files) and I can't seem to get the code to "find them". 但是,这些文件存储在Google驱动器的共享文件夹中(xlsx文件),我似乎无法获得“查找它们”的代码。 I am working on a Mac (if that makes a difference). 我正在Mac上工作(如果有帮助)。

Here is an example of what I have tried: 这是我尝试过的一个示例:

library("googledrive")
library("readxl")
library("curl")
library("googlesheets")
library("xlsx") # and a few more which I have tried!

> setwd("/Users/xxx/Documents/R") #working on a Mac
> WS.URL <- "https://drive.google.com/drive/u/0/folders/xxx" # this is the shared 
drive folder containing numerous xlsx files


##a - the main one I am trying to do ###
> list.files(path = "WS.URL")
character(0) ## there are about 10 files in this folder which aren't showing up. I can't create a loop if I can't retrieve the files.

#b
> nfiles <-length(WS)
> nfiles
[1] 1 # should be about 10


#c
dest <- ("/Users/xxx/Documents/R")
try(download.file("WS.URL", dest))

I have no idea if I am missing something really obvious, still getting to grips with R. Surely this should be straightforward? 我不知道我是否遗漏了一些确实很明显的东西,但仍然想与R保持联系。这肯定很简单吗?

HELP! 救命!

I cant help much with R but there is a parameter on file.list method called q its used for searching 我对R的帮助不大,但是file.list方法上有一个名为q的参数,用于搜索

GET https://www.googleapis.com/drive/v3/files?q=sharedWithMe GET https://www.googleapis.com/drive/v3/files?q=sharedWithMe

by return sending q=sharedWithMe it should return all the files that are shared with you. 通过返回发送q=sharedWithMe它应该返回与您共享的所有文件。 Testing the q method is easer using the Google APIs exploerer you might want to test it here 使用您可能要在此处进行测试的Google API开发工具,可以更轻松地测试q方法

Note as far as i know https://drive.google.com/drive/u/0/folders/xxx is not the proper end point for the google drive api which may be causing some of your issues. 请注意,据我所知, https://drive.google.com/drive/u/0/folders/xxx不是适用于google驱动器api的正确端点,这可能会导致您的某些问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 列出 Google Drive 文件元数据 - List Google Drive files metadata 在 PHP 中从 Google Drive v2 获取文件列表 - Get list of files from Google Drive v2 in PHP 用于将 google drive 中的文件名列表与 google sheet 列中的名称列表进行比较的 Apps 脚本,以将新文件从驱动器添加到工作表 - Apps Script to Compare a list of file names in google drive to a list of names in a google sheet column to add new files from drive to sheet 无法使用Google Drive API获取所有文件的列表 - Unable to get list of all files using google drive API 如何使用 PHP 列出 Google Cloud Storage 中存储桶中的所有文件? - How to list all the files from a bucket in Google Cloud Storage using PHP? 递归地从列表列表中识别 - Identifying from a List of Lists Recursively 如何从列表 python 中提取谷歌驱动器文件 ID? - how to pull google drive file id's from list python? 将列表中的数据排序到xlsx文件的列 - Sort data in a list to columns for xlsx files 如何在 R 中创建小标题列表(来自 xlsx 文件)而不丢失数据? - How to create a list of tibbles (from xlsx files) in R without losing data? 带有q参数和nextPageToken的Google Drive Web API“文件:列表”命令无法正常工作 - Google Drive Web APIs “Files: list” command with q parameter and nextPageToken doesnt work correctly
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM