All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Copy-edit

...

This method allow you to add new sheets to an existing spreadsheet. You can specify the sheet properties for the new sheet. It is an error to An error is thrown if you provide a title that is used for an existing sheet.

...

  • spreadsheetId :- Unique value of the spreadsheet
  • requests :- It contains data that is a kind of update to apply to a spreadsheet. To add multiple sheets within the spread sheet, need to repeat "addSheetBatchRequest" property within the requests attribute as below.

  • fields [Optional] :- Specifying which fields to include in a partial response. For the following request only the "spreadsheetId" will be included in the response.
Sample request

Following is a The sample request that can be used for given below calls the addSheetBatchRequest operation. With the following request we can specify The request specifies the multiple sheet properties, such as the sheet name ("Expenses1", "Expenses2"), sheet type ("GRID") and row, column count, and the dimension ((50,10), (70,10)) of the sheet as an array. Here we specify  The fields property is specified to get a partial response. Here, "spreadsheetId", "replies" The spreadsheetId and replies values will be included in the response. "replies" contains  contain properties such as sheet name, type, row, column count, and sheetId.

Code Block
languagexml
titleaddSheetBatchRequest
{
"clientId":"617729022812-xxxxxxxxxx.apps.googleusercontent.com",
"clientSecret":"xxxxxxxxxxxxxxxxx",
"refreshToken":"1/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-fCyxRTyf-LpK6fDWF9DgcM",
"accessToken":"ya29.xxxxxxxxxxxxxxxxxxxxxxxxxx-pOuVvnbnHhkVn5u8t6Qr",
"apiUrl":"https://sheets.googleapis.com/v4/spreadsheets",
"spreadsheetId": "1oGxpE3C_2elS4kcCZaB3JqVMiXCYLamC1CXZOgBzy9A",
"requests": [
  {
      "addSheet": {
          "properties": {
            "title": "Expenses1",
            "sheetType": "GRID",
            "gridProperties": {
              "rowCount": 50,
              "columnCount": 10
            }
          }
      }
  },
  {
      "addSheet": {
          "properties": {
            "title": "Expenses2",
            "sheetType": "GRID",
            "gridProperties": {
              "rowCount": 70,
              "columnCount": 10
            }
          }
      }
  }
],
  "fields": "spreadsheetId,replies"
}

...

Following is a sample request that can be used for deleteSheetBatchRequest operation. With the following request we can specify Id of the sheet need that needs to be deleted.

Code Block
titledeleteSheetBatchRequest
{
"clientId":"617729022812-xxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
"clientSecret":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"refreshToken":"1/xxxxxxxxxxxxxxxxxxxxxxx-fCyxRTyf-LpK6fDWF9DgcM",
"accessToken":"ya29.xxxxxxxxxxxxxxxxxxxxxxxxxxxxx-pOuVvnbnHhkVn5u8t6Qr",
"apiUrl":"https://sheets.googleapis.com/v4/spreadsheets",
"spreadsheetId": "12KoqoxmxxxxxxxxxxxxxxxxxxxxxKMEIFGCD9EBdrXFGA",
"requests": [
  {
      "deleteSheet":
      {
        "sheetId": 813171540
      }
    }
 ],
  "fields": "spreadsheetId"
}

...