读取托管在Google云端硬盘中的csv文件 [英] Read csv file hosted on Google Drive

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

问题描述

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

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'.

因此基于可共享的网址:

So based on the shareable URL:

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

我一直在尝试使用来阅读:

I have been trying to read in using:

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云端硬盘中的csv文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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