将未发布的 Google 电子表格下载为 CSV [英] Download unpublished Google spreadsheet as CSV

查看:30
本文介绍了将未发布的 Google 电子表格下载为 CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个尚未公开的 Google 电子表格,但只有拥有访问链接的任何人都可以使用.尽管即使我没有登录到我的 Google 帐户(即允许匿名访问),我也可以从我的浏览器访问 CSV 格式的数据,但我无法使用 wget 从命令行下载数据,以便即时.我找到了几个带有创建下载 URL 的说明的网页,但到目前为止我还没有成功.是否有一种简单、直接的方法来执行此操作,或者我是否必须使用某些 Google 数据库来访问该数据?

I have a Google spreadsheet that has not been made public, but just available to anyone that has the access link. Though I can access the data in CSV format from my browser even when I am not logged into my Google account (that is, anonymous access is allowed), there is no way I can download the data from the command line using wget, for instante. I have found several web pages with some instructions to create the download URL, but so far I've had no success. Is there an easy, straightforward way of doing this or will I have to use some Google Data library to access that data?

推荐答案

现在我可以回答问题了,所以我会一直回答它(从我之前的评论中粘贴).

Now I can answer questions, so I will leave it answered for good (pasting from my previous comment).

我的问题是我没有正确存储 cookie.当时,我正在使用 Python 程序尝试下载此程序.这解决了我报告的问题:

My problem was that I was not storing the cookie correctly. At the time, I was using a Python program to try to download this. This fixed the problem I was reporting:

# Cookie management 
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(CookieJar())) 
csv_data =  csv.reader(opener.open(url))

这篇关于将未发布的 Google 电子表格下载为 CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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