gspread.exceptions.SpreadsheetNotFound

TestIsFun

我正在编写一个python(ver 3)脚本以使用gspread访问google doc。

  1)  import gspread
  2)  from oauth2client.service_account import ServiceAccountCredentials
  3)  scope = ['https://spreadsheets.google.com/feeds']
  4)  credentials = ServiceAccountCredentials.from_json_keyfile_name(r'/path/to/jason/file/xxxxxx.json',scope)
  5)  gc = gspread.authorize(credentials)
  6)  wks = gc.open("test").sheet1

测试是一个谷歌表,似乎已经打开并阅读正常,但如果我尝试从Office excel文件中读取,则会给我error.here是它们的外观:在此处输入图片说明

test和mtg所在的文件夹与我在json文件中收到的电子邮件共享。

尝试过:

wks = gc.open("mtg.xls").sheet1

wks = gc.open("mtg.xls").<NameOfFirstSheet>

wks = gc.open("mtg").<NameOfFirstSheet> 

错误:

/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/gspread/client.py“,第152行,公开募集SpreadsheetNotFound gspread.exceptions.SpreadsheetNotFound

雅克·高丁(Jacques Gaudin)

.xls文件名的末尾没有要添加的内容,数据以其他格式保存(以后可以导出为.xls)。

尝试将您的代码分解为:

ss = open("MTG_Collection_5_14_16") 
ws = ss.worksheet("<NameOfFirstSheet>")

并发布错误消息(如果有)。

Spreadsheet实例具有属性,sheet1因为它是第一个工作表的默认名称。ss.sheet1实际返回的工作表的索引为0,无论其名称是什么。

如果要访问另一个工作表,则需要使用ss.worsheet("<title>")或之一ss.get_worksheet(<index>)ss.<NameOfFirstSheet>不管用。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Gspread 卡在授权上

来自分类Dev

GSpread如何复制工作表

来自分类Dev

gspread:如何更改整行的颜色?

来自分类常见问题

使用gspread提取工作表ID

来自分类Dev

python gspread google spreadsheet keeping connection alive

来自分类Dev

Gspread-更改监听器?

来自分类Dev

将gspread与代理一起使用

来自分类Dev

gspread update_cell非常慢

来自分类Dev

如何使用gspread缓存Google表格的授权?

来自分类Dev

使用gspread提取工作表ID

来自分类Dev

使用gspread acell获取特定的图纸范围

来自分类Dev

如何使用gspread添加嵌套列表?

来自分类Dev

Gspread-更改监听器?

来自分类Dev

gspread update_cell非常慢

来自分类Dev

gspread批量更新单元,限制为50k吗?

来自分类Dev

Google Auth2更新后,Gspread保持活跃

来自分类Dev

使用gspread或googleapiclient将行追加到Google表格中

来自分类Dev

长号ID由Pandas + Gspread转换为Scientific

来自分类Dev

AttributeError:模块“ gspread”没有属性“ open_by_key”

来自分类Dev

Windows Mobile或Windows CE上的Gspread和python

来自分类Dev

使用gspread软件包在闪亮的io中授权登录

来自分类Dev

在python中用gspread突出显示单元格

来自分类Dev

Gspread-无法检索电子表格

来自分类Dev

“~/.config/gspread_pandas/google secret.json”在哪里?

来自分类Dev

Testing Exceptions with Nunit

来自分类Dev

Catching exceptions in destructors

来自分类Dev

Using RAII to nest exceptions

来自分类Dev

Programmatically distinguish exceptions

来自分类Dev

python gspread谷歌电子表格保持连接活跃