0
我想通過按名稱搜索電子表格來檢索電子表格的數據。我想知道它是如何工作的?在python中通過api查找google電子表格
result = service.spreadsheets().values().get(title=spreadsheetTitle, range=rangeName).execute()
我想通過按名稱搜索電子表格來檢索電子表格的數據。我想知道它是如何工作的?在python中通過api查找google電子表格
result = service.spreadsheets().values().get(title=spreadsheetTitle, range=rangeName).execute()
從這個example,你可以打開一個電子表格的標題或網址。
例子:
def open(self, title):
"""Opens a spreadsheet, returning a :class:`~gspread.Spreadsheet` instance.
:param title: A title of a spreadsheet.
If there's more than one spreadsheet with same title the first one
will be opened.
:raises gspread.SpreadsheetNotFound: if no spreadsheet with
specified `title` is found.
>>> c = gspread.Client(auth=('[email protected]', 'qwertypassword'))
>>> c.login()
>>> c.open('My fancy spreadsheet')
"""
feed = self.get_spreadsheets_feed()
for elem in feed.findall(_ns('entry')):
elem_title = elem.find(_ns('title')).text
if elem_title.strip() == title:
return Spreadsheet(self, elem)
else:
raise SpreadsheetNotFound
您還可以檢查這些鏈接:
您可以使用pygsheets,一個Python庫爲谷歌牀單API V4 。
import pygsheets
gc = pygsheets.authorize()
# Open spreadsheet by title
sh = gc.open('my new ssheet')