Spreadsheet JavaScript API
Spreadsheets editor supports advanced JavaScript APIs.
The following section describes the supported methods in SpreadsheetApp class, Sheet class, and Range class.
Class SpreadsheetApp
Methods:
- getActiveSheet(callback)
- callback is user defined function that will be called after receiving the response from HCL Docs.
- getSheetByName(sheetName, callback)
- sheetName is the sheet name.
- getSheets(callback)
- callback is user defined function that will be called after receiving the specified event.
- insertSheetByName(sheetName)
- sheetName is the sheet name.
- save()
- Save the spreadsheet to file repository with a new file version.
Class Sheet
Methods:
- Sheet(sheetId)
- sheetId is the sheet id.
- activate()
- Activate this sheet in the spreadsheet.
- getActiveCell(callback)
- callback is user defined function that will be called after receiving the specified event.
- getActiveRange(callback)
- callback is user defined function that will be called after receiving the specified event.
- getIndex(callback)
- callback is user defined function that will be called after receiving the specified event.
- getRange(row, column, endRow, endColumn)
- row is the start row index.
- getSheetId()
- Return the sheet id.
- getSheetName(callback)
- callback is user defined function that will be called after receiving the specified event.
- hideSheet()
- Hide this sheet.
- isHiddenSheet(callback)
- callback is user defined function that will be called after receiving the specified event.
- setActveRange(range)
- range is the range object.
- setSheetName(sheetName)
- sheetName is the sheet name.
- showSheet()
- Unhide this sheet.
Class Range
Methods:
- Range(sheet, row, column, endRow, endColumn)
- sheet is the sheet object that this range belongs to.
- activate()
- Activate this range in the sheet.
- canEdit(callback)
- callback is user defined function that will be called after receiving the specified event.
- clearContent()
- Clear the range content.
- getSheet()
- Return the sheet object that this range belongs to.
- getRow()
- Return the start row index.
- getColumn()
- Return the start column index.
- getEndRow()
- Return the end row index.
- getEndColumn()
- Return the end column index.
- getCell(row, column)
- row is the row delta within range.
- getDisplayValue(callback)
- callback is user defined function that will be called after receiving the specified event.
- getDisplayValues(callback)
- callback is user defined function that will be called after receiving the specified event.
- getValue(callback)
- callback is user defined function that will be called after receiving the specified event.
- getValues(callback)
- callback is user defined function that will be called after receiving the specified event.
- getBackground(callback)
- callback is user defined function that will be called after receiving the specified event.
- getBackgrounds(callback)
- callback is user defined function that will be called after receiving the specified event.
- getFontColor(callback)
- callback is user defined function that will be called after receiving the specified event.
- getFontColors(callback)
- callback is user defined function that will be called after receiving the specified event.
- setBackground(color)
- color is a non-empty string (for example, "#FFFFFF").
- setFontColor(color)
- color is a non-empty string (for example, "#FFFFFF").
- setValue(value)
- value is a non-empty value that is either string, boolean or number.
- setValues(values)
- values is a two-dimensional array.