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.
Get active sheet in this spreadsheet.
getSheetByName(sheetName, callback)
sheetName is the sheet name.
callback is user defined function that will be called after receiving the response from HCL Docs.
Get one sheet object with the given sheet name.
getSheets(callback)
callback is user defined function that will be called after receiving the specified event.
Get one array of sheets in this spreadsheet.
insertSheetByName(sheetName)
sheetName is the sheet name.
Insert a new sheet with the given sheet name in this spreadsheet.
save()
Save the spreadsheet to file repository with a new file version.

Class Sheet

Methods:
Sheet(sheetId)
sheetId is the sheet id.
Create a new Sheet object.
activate()
Activate this sheet in the spreadsheet.
getActiveCell(callback)
callback is user defined function that will be called after receiving the specified event.
Get current active cell (in Range) of this sheet.
getActiveRange(callback)
callback is user defined function that will be called after receiving the specified event.
Get current active range of this sheet.
getIndex(callback)
callback is user defined function that will be called after receiving the specified event.
Get the index of this sheet in the sheet tab.
getRange(row, column, endRow, endColumn)
row is the start row index.
column is the start column index.
endRow is the end row index.
endColumn is the end column index.
Create a Range object.
getSheetId()
Return the sheet id.
getSheetName(callback)
callback is user defined function that will be called after receiving the specified event.
Get the name of this sheet.
hideSheet()
Hide this sheet.
isHiddenSheet(callback)
callback is user defined function that will be called after receiving the specified event.
Check whether this sheet is hidden.
setActveRange(range)
range is the range object.
Activate this range in this sheet.
setSheetName(sheetName)
sheetName is the sheet name.
Re-name this sheet with the new 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.
row is the start row index.
column is the start column index.
endRow is the end row index.
endColumn is the end column index.
Create a Range object.
activate()
Activate this range in the sheet.
canEdit(callback)
callback is user defined function that will be called after receiving the specified event.
Check whether the range is editable or not.
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.
column is the column delta within rang.
Return Range object for this cell.
getDisplayValue(callback)
callback is user defined function that will be called after receiving the specified event.
Get the displayed value of the beginning cell in this range.
getDisplayValues(callback)
callback is user defined function that will be called after receiving the specified event.
Get the displayed value for this range in a two-dimensional array.
getValue(callback)
callback is user defined function that will be called after receiving the specified event.
Get the value of the beginning cell in this range.
getValues(callback)
callback is user defined function that will be called after receiving the specified event.
Get the values for this range in a two-dimensional array.
getBackground(callback)
callback is user defined function that will be called after receiving the specified event.
Get background color of the beginning cell in this range.
getBackgrounds(callback)
callback is user defined function that will be called after receiving the specified event.
Get background colors of this range in a two-dimensional array.
getFontColor(callback)
callback is user defined function that will be called after receiving the specified event.
Get font color of the beginning cell in this range.
getFontColors(callback)
callback is user defined function that will be called after receiving the specified event.
Get font colors of this range in a two-dimensional array.
setBackground(color)
color is a non-empty string (for example, "#FFFFFF").
Set this range background with this color.
setFontColor(color)
color is a non-empty string (for example, "#FFFFFF").
Set this range font with this color.
setValue(value)
value is a non-empty value that is either string, boolean or number.
Set the beginning cell in this range with this value.
setValues(values)
values is a two-dimensional array.
Set this range with the values.