Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Formatting Cells in Google Sheets using API

I have the following request body to change multiple cell colors to red. However only one cell is being updated to red. Any ideas?

{'requests': [{'updateCells': {'range': {'sheetId': 212797248,
 'startRowIndex': 1,
 'endRowIndex': 6,
 'startColumnIndex': 0,
 'endColumnIndex': 10},
'rows': [{'values': [{'userEnteredFormat': {'backgroundColor': {'red': 1}}}]}],
'fields': 'userEnteredFormat.backgroundColor'}}]}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Try with

  {
    "requests": [
      {
        "repeatCell": {
          "range": {
            'sheetId': 1476957615, // 212797248,
            'startRowIndex': 1,
            'endRowIndex': 6,
            'startColumnIndex': 0,
            'endColumnIndex': 10
          },
          "cell": {
            "userEnteredFormat": {
              "backgroundColor": {
                "red": 1
              }
            }
          },
          "fields": "userEnteredFormat(backgroundColor,textFormat,horizontalAlignment)"
        }
      }
    ]
  }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading