How to add the column to Google Sheets using API a

2019-08-17 00:15发布

So, what I could achieve using the Google Sheets API is being able to create a new column using the following curl based call

curl -v \
-H 'Authorization: Bearer ya29.GlxUB9K_96tyQFyQ64eaYOeImtJt32213zjosf6LW1Inv6MOqQCCodA7CycvL5EFKIpeX4dVEebS4rUl24U1J7euhMjqBZq0QEU7ZK1B64THQXNwBpDvTzoUT9hTRg' \
-H 'Content-Type: application/json' \
-d '{
      "requests": [
        {
          "insertDimension": {
            "range": {
              "sheetId": 2052094881,
              "dimension": "COLUMNS",
              "startIndex": 0,
              "endIndex": 1
            }
          }
        }
      ],
    }' \
https://sheets.googleapis.com/v4/spreadsheets/1mHrPXQILuprO4NdqTgrVKlGazvvzgCFqIphGdsmptD8:batchUpdate

While this call is useful, it does not completely help. This is because the reason I wanted to add a column was to give a name and type (or format) the column values. But, as per this API, this is what see as an output enter image description here

Is there a way to create and add name and type to the column in a single API call?

Thanks a lot!

0条回答
登录 后发表回答