Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 如何阅读来自谷歌表格单元格的评论?_Excel_Python 3.x_Google Apps Script_Google Sheets_Gspread - Fatal编程技术网

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

Excel 如何阅读来自谷歌表格单元格的评论?,excel,python-3.x,google-apps-script,google-sheets,gspread,Excel,Python 3.x,Google Apps Script,Google Sheets,Gspread,我想从google sheets中的注释单元格访问数据。我做了一些工作,能够访问单元格中的值 from oauth2client.service_account import ServiceAccountCredentials import json scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] credentials = ServiceA

我想从google sheets中的注释单元格访问数据。我做了一些工作,能够访问单元格中的值

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库执行此类任务,特别是使用表模块

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()
来自sheetfu导入表的

电子表格=SpreadsheetApp('path/to/secret.json')。按id('')打开
数据范围=电子表格。按名称(“人员”)获取工作表。获取数据范围()
表=表(数据范围,注释=真)
对于表中的项目:
if item.get_field_note('name'):
#如果字段名上有注释,请执行某些操作
item.set\u field\u note('name','your note')
表1.commit()
你读过了吗?你是说笔记而不是评论吗?