【发布时间】:2016-05-27 10:06:35
【问题描述】:
我在 Google 表格中有一些值,其中一些是超链接的,比如这里的第三个:
我想检索每个单元格的文本值,以及超链接(如果存在)。
我可以使用gspread 轻松访问工作表:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name(
'./credentials.json', scope)
gc = gspread.authorize(credentials)
key = 'xxxxx'
wks = gc.open_by_key(key).worksheets()
for wk in wks:
links = wk.col_values(3)
for l in links:
print l.value
但是,这只会打印链接的字符串值,而不是链接指向的实际 href。
有谁知道是否可以使用 gspread 或其他库以编程方式检索此内容?
【问题讨论】:
标签: python google-sheets gspread