我想从Google表格中的注释单元格访问数据。我已经做了一些工作,并且能够访问单元格中的值。
from oauth2client.service_account import ServiceAccountCredentials
import json
scope = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name('WorkSheet001-4d8ce6dbd79f.json', scope)
gc = gspread.authorize(credentials)
wks = gc.open_by_url('https://docs.google.com/spreadsheets/d/1ME7WatXOmSEytwu7Qxem-a6BzCew36RKmD7KdhKMwbA/edit#gid=0').sheet1
print(wks.cell(2, 2).value)
print(wks.get_all_records())
我想要来自注释单元格的数据。想要访问数据,例如时间,日期和对单元格的评论等
[{'name': 'Naresh', 'technology': 'Php'}, {'name': 'kuldeep', 'technology': 'python'}]
答案 0 :(得分:0)
您可以尝试使用Sheetfu库来完成此类任务,特别是使用表模块。
from sheetfu import Table
spreadsheet = SpreadsheetApp('path/to/secret.json').open_by_id('<insert spreadsheet id here>')
data_range = spreadsheet.get_sheet_by_name('people').get_data_range()
table = Table(data_range, notes=True)
for item in table:
if item.get_field_note('name'):
# DO SOMETHING IF THERE IS A NOTE ON FIELD NAME
item.set_field_note('name', 'your note')
table.commit()