Hide gridlines with the Google Sheets API in Python

168 Views Asked by At

I want to remove all the gridlines in my google sheet. I think I need to use batchupdate in combination with a JSON request that sets the hideGridlines in gridProperties to True but I can't seem to get it to work.

Anyone knows how to do this?

This is what I have so far but it gives an error about not having a sheet name.

     [{
         'updateSheetProperties': {
                "fields": "*",
                "properties": {
                    "gridProperties": {
                        "hideGridlines": True,
                    },
                    "sheetId": self.sheet.id,
                },
            },
        }]
1

There are 1 best solutions below

0
Tanaike On BEST ANSWER

I thought that in your showing request body, it is required to modify the value of fields as follows.

From:

"fields": "*",

To:

"fields": "gridProperties.hideGridlines",

Reference: