2

I want to access data from the commented cell in google sheets. I have done some work, and able to access the value in the cell.

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())

I want data from the commented cell. want to access data like it's time, date and comment on the cell etc

[{'name': 'Naresh', 'technology': 'Php'}, {'name': 'kuldeep', 'technology': 'python'}]
player0
  • 124,011
  • 12
  • 67
  • 124
kd007
  • 339
  • 1
  • 13

1 Answers1

0

You could try Sheetfu library for this type of task, specifically using the table module.

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()
Philippe Oger
  • 1,021
  • 9
  • 21