我在Google Sheet中有一些数值,其中一些是超链接,比如这里的第三个:
我希望能够获取每个单元格的文本值,以及存在时的超链接。我可以很容易地使用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或其他库以编程方式检索它吗?
value_render_option
关键字参数,例如worksheet.cell(1, 1, value_render_option='FORMULA')
。 - Jacques Gaudinvalue_render_option
的文档在这里:https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption - Jacques Gaudin