我想从谷歌表格中的注释单元格中访问数据。我已经完成了一些工作,并且能够访问单元格中的值。
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'}]
最佳答案
您可以尝试使用 Sheetfu 库来完成此类任务,特别是使用 table 模块。
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()
关于excel - 如何从谷歌表格单元格中读取评论?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55809706/