E
E
Emil Revencu2018-09-18 22:47:54
Python
Emil Revencu, 2018-09-18 22:47:54

How to get Notes from Google Sheet using Python?

I get cell values ​​like this:

import httplib2
import apiclient.discovery
from oauth2client.service_account import ServiceAccountCredentials

CREDENTIALS_FILE = 'credentials.json'
credentials = ServiceAccountCredentials.from_json_keyfile_name(CREDENTIALS_FILE, ['https://www.googleapis.com/auth/spreadsheets', 'https://www.googleapis.com/auth/drive'])
httpAuth = credentials.authorize(httplib2.Http())
SHEETS = apiclient.discovery.build('sheets', 'v4', http = httpAuth)
SHEET_ID = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
result = SHEETS.spreadsheets().values().batchGet(spreadsheetId=SHEET_ID, ranges='Sheet1!A:F').execute()
print result

And how to get notes (notes) of cells?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2019-01-29
@oshliaer

from googleapiclient.discovery import build
service = build('sheets', 'v4')

response = service.spreadsheets().get(spreadsheetId = spreadsheetId,
    fields = 'sheets(data.rowData.values.note)').execute()

print(response)

You can run the code "here and now" at the link https://colab.research.google.com/drive/1dbUChgxPF...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question