读取托管在 Google Drive 上的 csv 文件 [英] Read csv file hosted on Google Drive

查看:18
本文介绍了读取托管在 Google Drive 上的 csv 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试访问(读入 R)Google Drive 上托管的 .csv 文件(不是 Drive 电子表格)——已将文件权限设置为可公开共享".

I am trying to access (read into R) a .csv file hosted on Google Drive (NOT a Drive spreadsheet) -- having set file permission to 'publicly shareable'.

因此基于可共享的 URL:

So based on the shareable URL:

sURL <-"https://drive.google.com/file....view?pli=1"

我一直在尝试使用:

library(curl)
x <- curl(sURL)
data <- read.csv(x)

我收到此错误消息:

Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
more columns than column names

知道投诉是关于什么的吗?谢谢各位.

Any idea what the complaint is about? Thanks guys.

推荐答案

你可以这样试试

id <- "0B-wuZ2XMFIBUd09Ob0pKVkRzQTA" # google file ID
read.csv(sprintf("https://docs.google.com/uc?id=%s&export=download", id))

这篇关于读取托管在 Google Drive 上的 csv 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆