从Google Drive读取文件
我已经在Google Drive已解锁的Google Drive中将电子表格上传为CSV文件,因此用户可以从中阅读。 这是CSV文件的链接: https://docs.google.com/spreadsheets/d/170235qwbmgqvr0gwmt-8ybsc7vk6p_dmvyxrznfskqkqkqkqkqkqk/edit
?我正在使用:
id = "170235QwbmgQvr0GWmT-8yBsC7Vk6p_dmvYxrZNfsKqk"
read.csv(sprint("https://docs.google.com/spreadsheets/d/uc?id=%s&export=download",id))
有人可以建议如何将Google Drive直接读取到R中吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我会尝试以CSV文件( doc )) ,然后从那里阅读。
似乎您的文件已经以CSV的形式出版。因此,这应该起作用。 (请注意,URL以
/pub?output = CSV
结束)I would try to publish the sheet as a CSV file (doc), and then read it from there.
It seems like your file is already published as a CSV. So, this should work. (Note that the URL ends with
/pub?output=csv
)要更快地读取CSV文件,您可以使用 甚至比
fread()
更快。 请参阅此处。现在使用vroom,
在2022-07-08创建的 reprex package (v2.0.1)< /sup>
To read the CSV file faster you can use
vroom
which is even faster thanfread()
. See here.Now using vroom,
Created on 2022-07-08 by the reprex package (v2.0.1)
googlesheets4 对我来说很好。
我不记得这些细节,但我确实相信您确实必须在Google帐户上授予图书馆权限。要考虑的东西。
您也可以分配特定的表格。默认情况下,它在文档中获取第一张纸。文件对象是R数据框。
googlesheets4 works well for me.
I don't remember the specifics but I do believe you do have to give the library permissions on your google account. Something to consider.
You can assign the specific sheet your after as well. By default it grabs the first sheet in the document. The file object is a R dataframe.