Create a new Google Sheet with row or column group

2019-03-02 22:58发布

问题:

I'm trying to create a new spreadsheet using spreadsheets#create, with specified row groups.

In the API Explorer, I am entering in the JSON below. which corresponds to the following appearance:

No errors are flagged or returned when I execute the call, but when the sheet is created, the specified grouping is not created - only the values are set.

{ "properties": {
    "title": "Test Spreadsheet",
    "locale": "en"
  },
  "sheets": [
    { "properties": {"title": "Test1"},
      "data": [
        {
          "startRow": 0,
          "startColumn": 0,
          "rowData": [
            { "values": [
                { "userEnteredValue": { "stringValue": "Top1" } }
              ]
            },
            { "values": [
                { "userEnteredValue": { "stringValue": "Top2" } }
              ]
            },
            { "values": [
                { "userEnteredValue": { "stringValue": "" } },
                { "userEnteredValue": { "stringValue": "Top2A" } }
              ]
            },
            { "values": [
                { "userEnteredValue": { "stringValue": "" } },
                { "userEnteredValue": { "stringValue": "Top2B" } }
              ]
            },
            { "values": [
                { "userEnteredValue": { "stringValue": "" } },
                { "userEnteredValue": { "stringValue": "Top2C" } }
              ]
            },
            { "values": [
                { "userEnteredValue": { "stringValue": "Top3" } }
              ]
            }
          ]
        }
      ],
      "rowGroups": [
        { "range": {
            "dimension": "ROWS",
            "startIndex": 2,
            "endIndex": 5
          }
        }
      ]
    }
  ]
}

Even when I create the rowGroups JSON directly on the page, with its structured editor to make sure it is properly defined, the created spreadsheet still doesn't group the specified rows. I have triple-checked all my objects from the top down, and can't see what I am doing wrong.