如何阅读谷歌表单元格的评论?

问题描述 投票:2回答:1

我想从谷歌表中的评论单元格访问数据。我做了一些工作,并能够访问单元格中的值。

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'}]
excel python-3.x google-apps-script google-sheets gspread
1个回答
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()
© www.soinside.com 2019 - 2024. All rights reserved.