79277094

Date: 2024-12-13 02:38:57
Score: 0.5
Natty:
Report link

Use Google Sheet API directly.

from googleapiclient.discovery import build

sheets_service = build('sheets', 'v4', credentials=credentials)
content = request.form.get('content')

# Define the range for the cell
range_ = 'Sheet1!A1'

comment = {
    'content': content,
    'location': {
        'sheetId': 0,
        'rowIndex': 0,
        'columnIndex': 0
    }
}

sheets_service.spreadsheets().comments().create(
    spreadsheetId=SPREADSHEET_ID,
    body=comment
).execute()

Google Drive API will allow you to comment on file level and not cell level

Reasons:
  • Blacklisted phrase (1): to comment
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Sarthak Bhan