Search

Delete Range

Last Updated: May 27, 2021

Articles

Use this function to delete the range of cells by shifting the rows or columns in a worksheet.

Syntax

Delete Range (id_or_url, sheet_name_or_index , rng, shift_dimension, private_key, cient_email)

Parameters

Input Parameter Name Description
id_or_url ID or URL of Google Sheet
sheet_name_or_index Name or index of worksheet
rng Cell Range
shift_dimension Dimension to shift the cells after deleting range of cells rows. Allowed inputs are
  • Row
  • Column
private_key Private key of the service account
client_email Email ID of the service account

Returns

Return Value Description
Output
  • On Success returns 1, Range of cells are deleted successfully
  • On Failure returns 0, Error Message

Sample

Delete Range (ABC123, Invoice, A1:B2, Row, —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—–, name@project-id.iam.gserviceaccount.com)

  • Uses the private key —–BEGIN PRIVATE KEY—–\nABCD\n—–END PRIVATE KEY—– to connect to the Email ID name@project-id.iam.gserviceaccount.com, accesses the sheet Invoice using the ID ABC123 and deletes the cells in the range A1:B2 and shifts the cells by Row.
    Returns Range of cells are deleted successfully on deleting the range.

To view all the Google Sheets functions, click here.

Did you find what you were looking for?