read.csv无法从Google文档读取CSV文件 [英] read.csv fails to read a CSV file from google docs

查看:111
本文介绍了read.csv无法从Google文档读取CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用read.csv来读取Google文档电子表格.

I wish to use read.csv to read a google doc spreadsheet.

我尝试使用以下代码:

data_url <- "http://spreadsheets0.google.com/spreadsheet/pub?hl=en&hl=en&key=0AgMhDTVek_sDdGI2YzY2R1ZESDlmZS1VYUxvblQ0REE&single=true&gid=0&output=csv"
read.csv(data_url)

这将导致以下错误:

Error in file(file, "rt") : cannot open the connection

我在Windows 7上,并且在R 2.12和2.13上尝试了该代码

I'm on windows 7. And the code was tried on R 2.12 and 2.13

我记得几个月前尝试过这种方法,效果很好. 有什么建议可能导致此问题或如何解决?

I remember trying this a few months ago and it worked fine. Any suggestion what might be causing this or how to solve it?

谢谢.

推荐答案

我遇到了同样的问题,并最终在

I ran into the same problem and eventually found a solution in a forum thread. Using my own public CSV file:

library(RCurl)
tt = getForm("https://spreadsheets.google.com/spreadsheet/pub", 
          hl ="en_US", key = "0Aonsf4v9iDjGdHRaWWRFbXdQN1ZvbGx0LWVCeVd0T1E", 
          output = "csv", 
         .opts = list(followlocation = TRUE, verbose = TRUE, ssl.verifypeer = FALSE)) 

holidays <- read.csv(textConnection(tt))

这篇关于read.csv无法从Google文档读取CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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