Google Apps Script

Spreadsheet Service

This service allows scripts to create, access, and modify Google Sheets files. See also the guide to storing data in spreadsheets.

Classes

NameBrief description
ContainerInfoThe chart's position within a sheet.
DataValidationThis class allows users to access existing data-validation rules.
DataValidationBuilderBuilder for data-validation rules.
DataValidationCriteriaAn enumeration representing the data-validation criteria that can be set on a range.
EmbeddedAreaChartBuilderBuilder for area charts.
EmbeddedBarChartBuilderBuilder for bar charts.
EmbeddedChartRepresents a chart that has been embedded into a Spreadsheet.
EmbeddedChartBuilderThis builder allows you to edit an EmbeddedChart.
EmbeddedColumnChartBuilderBuilder for column charts.
EmbeddedLineChartBuilderBuilder for line charts.
EmbeddedPieChartBuilderBuilder for pie charts.
EmbeddedScatterChartBuilderBuilder for scatter charts.
EmbeddedTableChartBuilderBuilder for table charts.
PageProtectionAccess and modify the state of protection permissions on a sheet.
RangeAccess and modify spreadsheet ranges.
SheetAccess and modify spreadsheet sheets.
SpreadsheetThis class allows users to access and modify Google Sheets files.
SpreadsheetAppThis class allows users to open Google Sheets files and to create new ones.

Class ContainerInfo

Methods

MethodReturn typeBrief description
getAnchorColumn()IntegerThe chart's left side will be anchored in this column.
getAnchorRow()IntegerThe chart's top side will be anchored in this row.
getOffsetX()IntegerThe chart's upper left hand corner will be offset from the anchor column by this many pixels.
getOffsetY()IntegerChart's upper left hand corner will be offset from the anchor row by this many pixels.

Class DataValidation

Methods

MethodReturn typeBrief description
copy()DataValidationBuilderCreates a builder for a data-validation rule based on this rule's settings.
getAllowInvalid()BooleanReturns true if the rule shows a warning when input fails data validation, or false if it rejects the input entirely.
getCriteriaType()DataValidationCriteriaGets the rule's criteria type as defined in the DataValidationCriteria enum.
getCriteriaValues()Object[]Gets an array of arguments for the rule's criteria.
getHelpText()StringGets the rule's help text, or null if no help text is set.

Class DataValidationBuilder

Methods

MethodReturn typeBrief description
build()DataValidationConstructs a data-validation rule from the settings applied to the builder.
copy()DataValidationBuilderCreates a builder for a data-validation rule based on this rule's settings.
getAllowInvalid()BooleanReturns true if the rule shows a warning when input fails data validation, or false if it rejects the input entirely.
getCriteriaType()DataValidationCriteriaGets the rule's criteria type as defined in the DataValidationCriteria enum.
getCriteriaValues()Object[]Gets an array of arguments for the rule's criteria.
getHelpText()StringGets the rule's help text, or null if no help text is set.
requireDate()DataValidationBuilderSets the data-validation rule to require a date.
requireDateAfter(date)DataValidationBuilderSets the data-validation rule to require a date after the given value.
requireDateBefore(date)DataValidationBuilderSets the data-validation rule to require a date before the given value.
requireDateBetween(start, end)DataValidationBuilderSets the data-validation rule to require a date between the given values, inclusive of the values themselves.
requireDateEqualTo(date)DataValidationBuilderSets the data-validation rule to require a date equal to the given value.
requireDateNotBetween(start, end)DataValidationBuilderSets the data-validation rule to require a date not between the given values, inclusive of the values themselves.
requireDateOnOrAfter(date)DataValidationBuilderSets the data-validation rule to require a date on or after the given value.
requireDateOnOrBefore(date)DataValidationBuilderSets the data-validation rule to require a date on or before the given value.
requireFormulaSatisfied(formula)DataValidationBuilderSets the data-validation rule to require that the given formula evaluates to true.
requireNumberBetween(start, end)DataValidationBuilderSets the data-validation rule to require a number between the given values, inclusive of the values themselves.
requireNumberEqualTo(number)DataValidationBuilderSets the data-validation rule to require a number equal to the given value.
requireNumberGreaterThan(number)DataValidationBuilderSets the data-validation rule to require a number greater than the given value.
requireNumberGreaterThanOrEqualTo(number)DataValidationBuilderSets the data-validation rule to require a number greater than or equal to the given value.
requireNumberLessThan(number)DataValidationBuilderSets the data-validation rule to require a number less than the given value.
requireNumberLessThanOrEqualTo(number)DataValidationBuilderSets the data-validation rule to require a number less than or equal to the given value.
requireNumberNotBetween(start, end)DataValidationBuilderSets the data-validation rule to require a number not between the given values, inclusive of the values themselves.
requireNumberNotEqualTo(number)DataValidationBuilderSets the data-validation rule to require a number not equal to the given value.
requireTextContains(text)DataValidationBuilderSets the data-validation rule to require that the input contains the given value.
requireTextDoesNotContain(text)DataValidationBuilderSets the data-validation rule to require that the input does not contain the given value.
requireTextEqualTo(text)DataValidationBuilderSets the data-validation rule to require that the input is equal to the given value.
requireTextIsEmail()DataValidationBuilderSets the data-validation rule to require that the input is in the form of an email address.
requireTextIsUrl()DataValidationBuilderSets the data-validation rule to require that the input is in the form of a URL.
requireValueInList(values)DataValidationBuilderSets the data-validation rule to require that the input is equal to one of the given values.
requireValueInList(values, showDropdown)DataValidationBuilderSets the data-validation rule to require that the input is equal to one of the given values, with an option to hide the dropdown menu.
requireValueInRange(range)DataValidationBuilderSets the data-validation rule to require that the input is equal to a value in the given range.
requireValueInRange(range, showDropdown)DataValidationBuilderSets the data-validation rule to require that the input is equal to a value in the given range, with an option to hide the dropdown menu.
setAllowInvalid(allowInvalidData)DataValidationBuilderSets whether to show a warning when input fails data validation or whether to reject the input entirely.
setHelpText(helpText)DataValidationBuilderSets the help text shown when the user hovers over the cell on which data-validation is set.
withCriteria(criteria, args)DataValidationBuilderSets the data-validation rule to require criteria defined in the DataValidationCriteria enum.

Class DataValidationCriteria

Properties

PropertyTypeDescription
DATE_AFTEREnumRequires a date that is after the given value.
DATE_BEFOREEnumRequires a date that is before the given value.
DATE_BETWEENEnumRequires a date that is between the given values.
DATE_EQUAL_TOEnumRequires a date that is equal to the given value.
DATE_IS_VALID_DATEEnumRequires a date.
DATE_NOT_BETWEENEnumRequires a date that is not between the given values.
DATE_ON_OR_AFTEREnumRequire a date that is on or after the given value.
DATE_ON_OR_BEFOREEnumRequires a date that is on or before the given value.
NUMBER_BETWEENEnumRequires a number that is between the given values.
NUMBER_EQUAL_TOEnumRequires a number that is equal to the given value.
NUMBER_GREATER_THANEnumRequire a number that is greater than the given value.
NUMBER_GREATER_THAN_OR_EQUAL_TOEnumRequires a number that is greater than or equal to the given value.
NUMBER_LESS_THANEnumRequires a number that is less than the given value.
NUMBER_LESS_THAN_OR_EQUAL_TOEnumRequires a number that is less than or equal to the given value.
NUMBER_NOT_BETWEENEnumRequires a number that is not between the given values.
NUMBER_NOT_EQUAL_TOEnumRequires a number that is not equal to the given value.
TEXT_CONTAINSEnumRequires that the input contains the given value.
TEXT_DOES_NOT_CONTAINEnumRequires that the input does not contain the given value.
TEXT_EQUAL_TOEnumRequires that the input is equal to the given value.
TEXT_IS_VALID_EMAILEnumRequires that the input is in the form of an email address.
TEXT_IS_VALID_URLEnumRequires that the input is in the form of a URL.
VALUE_IN_LISTEnumRequires that the input is equal to one of the given values.
VALUE_IN_RANGEEnumRequires that the input is equal to a value in the given range.
CUSTOM_FORMULAEnumRequires that the input makes the given formula evaluate to true.

Class EmbeddedAreaChartBuilder

Methods

MethodReturn typeBrief description
addRange(range)EmbeddedChartBuilderAdds a Range to the chart represented by this builder.
asAreaChart()EmbeddedAreaChartBuilderSets the chart type to AreaChart and returns an EmbeddedAreaChartBuilder.
asBarChart()EmbeddedBarChartBuilderSets the chart type to BarChart and returns an EmbeddedBarChartBuilder.
asColumnChart()EmbeddedColumnChartBuilderSets the chart type to ColumnChart and returns an EmbeddedColumnChartBuilder.
asLineChart()EmbeddedLineChartBuilderSets the chart type to LineChart and returns an EmbeddedLineChartBuilder.
asPieChart()EmbeddedPieChartBuilderSets the chart type to PieChart and returns an EmbeddedPieChartBuilder.
asScatterChart()EmbeddedScatterChartBuilderSets the chart type to ScatterChart and returns an EmbeddedScatterChartBuilder.
asTableChart()EmbeddedTableChartBuilderSets the chart type to TableChart and returns an EmbeddedTableChartBuilder.
build()EmbeddedChartBuilds the chart to reflect all changes made to it.
getChartType()ChartTypeReturns the current chart type.
getContainer()ContainerInfoReturn the ContainerInfo, which encapsulates where the chart appears on the sheet.
getRanges()Range[]Returns a copy of the list of ranges currently providing data for this chart.
removeRange(range)EmbeddedChartBuilderRemoves the specified Range from the chart represented by this builder.
reverseCategories()EmbeddedAreaChartBuilderReverses the drawing of series in the domain axis.
setBackgroundColor(cssValue)EmbeddedAreaChartBuilderSets the background color for the chart.
setChartType(type)EmbeddedChartBuilderChanges the type of chart.
setColors(cssValues)EmbeddedAreaChartBuilderSets the colors for the lines in the chart.
setLegendPosition(position)EmbeddedAreaChartBuilderSets the position of the legend with respect to the chart.
setLegendTextStyle(textStyle)EmbeddedAreaChartBuilderSets the text style of the chart legend.
setOption(option, value)EmbeddedChartBuilder

Sets advanced options for this chart.

setPointStyle(style)EmbeddedAreaChartBuilderSets the style for points in the line.
setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)EmbeddedChartBuilderSets the position, changing where the chart appears on the sheet.
setRange(start, end)EmbeddedAreaChartBuilderSets the range for the chart.
setStacked()EmbeddedAreaChartBuilderUses stacked lines, meaning that line and bar values are stacked (accumulated).
setTitle(chartTitle)EmbeddedAreaChartBuilderSets the title of the chart.
setTitleTextStyle(textStyle)EmbeddedAreaChartBuilderSets the text style of the chart title.
setXAxisTextStyle(textStyle)EmbeddedAreaChartBuilderSets the horizontal axis text style.
setXAxisTitle(title)EmbeddedAreaChartBuilderAdds a title to the horizontal axis.
setXAxisTitleTextStyle(textStyle)EmbeddedAreaChartBuilderSets the horizontal axis title text style.
setYAxisTextStyle(textStyle)EmbeddedAreaChartBuilderSets the vertical axis text style.
setYAxisTitle(title)EmbeddedAreaChartBuilderAdds a title to the vertical axis.
setYAxisTitleTextStyle(textStyle)EmbeddedAreaChartBuilderSets the vertical axis title text style.
useLogScale()EmbeddedAreaChartBuilderMakes the range axis into a logarithmic scale (requires all values to be positive).

Class EmbeddedBarChartBuilder

Methods

MethodReturn typeBrief description
addRange(range)EmbeddedChartBuilderAdds a Range to the chart represented by this builder.
asAreaChart()EmbeddedAreaChartBuilderSets the chart type to AreaChart and returns an EmbeddedAreaChartBuilder.
asBarChart()EmbeddedBarChartBuilderSets the chart type to BarChart and returns an EmbeddedBarChartBuilder.
asColumnChart()EmbeddedColumnChartBuilderSets the chart type to ColumnChart and returns an EmbeddedColumnChartBuilder.
asLineChart()EmbeddedLineChartBuilderSets the chart type to LineChart and returns an EmbeddedLineChartBuilder.
asPieChart()EmbeddedPieChartBuilderSets the chart type to PieChart and returns an EmbeddedPieChartBuilder.
asScatterChart()EmbeddedScatterChartBuilderSets the chart type to ScatterChart and returns an EmbeddedScatterChartBuilder.
asTableChart()EmbeddedTableChartBuilderSets the chart type to TableChart and returns an EmbeddedTableChartBuilder.
build()EmbeddedChartBuilds the chart to reflect all changes made to it.
getChartType()ChartTypeReturns the current chart type.
getContainer()ContainerInfoReturn the ContainerInfo, which encapsulates where the chart appears on the sheet.
getRanges()Range[]Returns a copy of the list of ranges currently providing data for this chart.
removeRange(range)EmbeddedChartBuilderRemoves the specified Range from the chart represented by this builder.
reverseCategories()EmbeddedBarChartBuilderReverses the drawing of series in the domain axis.
reverseDirection()EmbeddedBarChartBuilderReverses the direction in which the bars grow along the horizontal axis.
setBackgroundColor(cssValue)EmbeddedBarChartBuilderSets the background color for the chart.
setChartType(type)EmbeddedChartBuilderChanges the type of chart.
setColors(cssValues)EmbeddedBarChartBuilderSets the colors for the lines in the chart.
setLegendPosition(position)EmbeddedBarChartBuilderSets the position of the legend with respect to the chart.
setLegendTextStyle(textStyle)EmbeddedBarChartBuilderSets the text style of the chart legend.
setOption(option, value)EmbeddedChartBuilder

Sets advanced options for this chart.

setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)EmbeddedChartBuilderSets the position, changing where the chart appears on the sheet.
setRange(start, end)EmbeddedBarChartBuilderSets the range for the chart.
setStacked()EmbeddedBarChartBuilderUses stacked lines, meaning that line and bar values are stacked (accumulated).
setTitle(chartTitle)EmbeddedBarChartBuilderSets the title of the chart.
setTitleTextStyle(textStyle)EmbeddedBarChartBuilderSets the text style of the chart title.
setXAxisTextStyle(textStyle)EmbeddedBarChartBuilderSets the horizontal axis text style.
setXAxisTitle(title)EmbeddedBarChartBuilderAdds a title to the horizontal axis.
setXAxisTitleTextStyle(textStyle)EmbeddedBarChartBuilderSets the horizontal axis title text style.
setYAxisTextStyle(textStyle)EmbeddedBarChartBuilderSets the vertical axis text style.
setYAxisTitle(title)EmbeddedBarChartBuilderAdds a title to the vertical axis.
setYAxisTitleTextStyle(textStyle)EmbeddedBarChartBuilderSets the vertical axis title text style.
useLogScale()EmbeddedBarChartBuilderMakes the range axis into a logarithmic scale (requires all values to be positive).

Class EmbeddedChart

Methods

MethodReturn typeBrief description
getAs(contentType)BlobReturn the data inside this object as a blob converted to the specified content type.
getBlob()BlobReturn the data inside this object as a blob.
getContainerInfo()ContainerInfoReturns information about where the chart is positioned within a sheet.
getId()StringReturns the id that has been assigned to this object.
getOptions()ChartOptionsReturns the options for this chart, such as height, colors, axes, etc.
getRanges()Range[]Returns the Ranges that this chart uses as a data source.
getType()StringGets the type of this object.
modify()EmbeddedChartBuilderReturns an EmbeddedChartBuilder that can be used to modify this chart.
setId(id)ChartSets the id of this EmbeddedChart to be used with UiApp.

Class EmbeddedChartBuilder

Methods

MethodReturn typeBrief description
addRange(range)EmbeddedChartBuilderAdds a Range to the chart represented by this builder.
asAreaChart()EmbeddedAreaChartBuilderSets the chart type to AreaChart and returns an EmbeddedAreaChartBuilder.
asBarChart()EmbeddedBarChartBuilderSets the chart type to BarChart and returns an EmbeddedBarChartBuilder.
asColumnChart()EmbeddedColumnChartBuilderSets the chart type to ColumnChart and returns an EmbeddedColumnChartBuilder.
asLineChart()EmbeddedLineChartBuilderSets the chart type to LineChart and returns an EmbeddedLineChartBuilder.
asPieChart()EmbeddedPieChartBuilderSets the chart type to PieChart and returns an EmbeddedPieChartBuilder.
asScatterChart()EmbeddedScatterChartBuilderSets the chart type to ScatterChart and returns an EmbeddedScatterChartBuilder.
asTableChart()EmbeddedTableChartBuilderSets the chart type to TableChart and returns an EmbeddedTableChartBuilder.
build()EmbeddedChartBuilds the chart to reflect all changes made to it.
getChartType()ChartTypeReturns the current chart type.
getContainer()ContainerInfoReturn the ContainerInfo, which encapsulates where the chart appears on the sheet.
getRanges()Range[]Returns a copy of the list of ranges currently providing data for this chart.
removeRange(range)EmbeddedChartBuilderRemoves the specified Range from the chart represented by this builder.
setChartType(type)EmbeddedChartBuilderChanges the type of chart.
setOption(option, value)EmbeddedChartBuilder

Sets advanced options for this chart.

setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)EmbeddedChartBuilderSets the position, changing where the chart appears on the sheet.

Class EmbeddedColumnChartBuilder

Methods

MethodReturn typeBrief description
addRange(range)EmbeddedChartBuilderAdds a Range to the chart represented by this builder.
asAreaChart()EmbeddedAreaChartBuilderSets the chart type to AreaChart and returns an EmbeddedAreaChartBuilder.
asBarChart()EmbeddedBarChartBuilderSets the chart type to BarChart and returns an EmbeddedBarChartBuilder.
asColumnChart()EmbeddedColumnChartBuilderSets the chart type to ColumnChart and returns an EmbeddedColumnChartBuilder.
asLineChart()EmbeddedLineChartBuilderSets the chart type to LineChart and returns an EmbeddedLineChartBuilder.
asPieChart()EmbeddedPieChartBuilderSets the chart type to PieChart and returns an EmbeddedPieChartBuilder.
asScatterChart()EmbeddedScatterChartBuilderSets the chart type to ScatterChart and returns an EmbeddedScatterChartBuilder.
asTableChart()EmbeddedTableChartBuilderSets the chart type to TableChart and returns an EmbeddedTableChartBuilder.
build()EmbeddedChartBuilds the chart to reflect all changes made to it.
getChartType()ChartTypeReturns the current chart type.
getContainer()ContainerInfoReturn the ContainerInfo, which encapsulates where the chart appears on the sheet.
getRanges()Range[]Returns a copy of the list of ranges currently providing data for this chart.
removeRange(range)EmbeddedChartBuilderRemoves the specified Range from the chart represented by this builder.
reverseCategories()EmbeddedColumnChartBuilderReverses the drawing of series in the domain axis.
setBackgroundColor(cssValue)EmbeddedColumnChartBuilderSets the background color for the chart.
setChartType(type)EmbeddedChartBuilderChanges the type of chart.
setColors(cssValues)EmbeddedColumnChartBuilderSets the colors for the lines in the chart.
setLegendPosition(position)EmbeddedColumnChartBuilderSets the position of the legend with respect to the chart.
setLegendTextStyle(textStyle)EmbeddedColumnChartBuilderSets the text style of the chart legend.
setOption(option, value)EmbeddedChartBuilder

Sets advanced options for this chart.

setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)EmbeddedChartBuilderSets the position, changing where the chart appears on the sheet.
setRange(start, end)EmbeddedColumnChartBuilderSets the range for the chart.
setStacked()EmbeddedColumnChartBuilderUses stacked lines, meaning that line and bar values are stacked (accumulated).
setTitle(chartTitle)EmbeddedColumnChartBuilderSets the title of the chart.
setTitleTextStyle(textStyle)EmbeddedColumnChartBuilderSets the text style of the chart title.
setXAxisTextStyle(textStyle)EmbeddedColumnChartBuilderSets the horizontal axis text style.
setXAxisTitle(title)EmbeddedColumnChartBuilderAdds a title to the horizontal axis.
setXAxisTitleTextStyle(textStyle)EmbeddedColumnChartBuilderSets the horizontal axis title text style.
setYAxisTextStyle(textStyle)EmbeddedColumnChartBuilderSets the vertical axis text style.
setYAxisTitle(title)EmbeddedColumnChartBuilderAdds a title to the vertical axis.
setYAxisTitleTextStyle(textStyle)EmbeddedColumnChartBuilderSets the vertical axis title text style.
useLogScale()EmbeddedColumnChartBuilderMakes the range axis into a logarithmic scale (requires all values to be positive).

Class EmbeddedLineChartBuilder

Methods

MethodReturn typeBrief description
addRange(range)EmbeddedChartBuilderAdds a Range to the chart represented by this builder.
asAreaChart()EmbeddedAreaChartBuilderSets the chart type to AreaChart and returns an EmbeddedAreaChartBuilder.
asBarChart()EmbeddedBarChartBuilderSets the chart type to BarChart and returns an EmbeddedBarChartBuilder.
asColumnChart()EmbeddedColumnChartBuilderSets the chart type to ColumnChart and returns an EmbeddedColumnChartBuilder.
asLineChart()EmbeddedLineChartBuilderSets the chart type to LineChart and returns an EmbeddedLineChartBuilder.
asPieChart()EmbeddedPieChartBuilderSets the chart type to PieChart and returns an EmbeddedPieChartBuilder.
asScatterChart()EmbeddedScatterChartBuilderSets the chart type to ScatterChart and returns an EmbeddedScatterChartBuilder.
asTableChart()EmbeddedTableChartBuilderSets the chart type to TableChart and returns an EmbeddedTableChartBuilder.
build()EmbeddedChartBuilds the chart to reflect all changes made to it.
getChartType()ChartTypeReturns the current chart type.
getContainer()ContainerInfoReturn the ContainerInfo, which encapsulates where the chart appears on the sheet.
getRanges()Range[]Returns a copy of the list of ranges currently providing data for this chart.
removeRange(range)EmbeddedChartBuilderRemoves the specified Range from the chart represented by this builder.
reverseCategories()EmbeddedLineChartBuilderReverses the drawing of series in the domain axis.
setBackgroundColor(cssValue)EmbeddedLineChartBuilderSets the background color for the chart.
setChartType(type)EmbeddedChartBuilderChanges the type of chart.
setColors(cssValues)EmbeddedLineChartBuilderSets the colors for the lines in the chart.
setCurveStyle(style)EmbeddedLineChartBuilderSets the style to use for curves in the chart.
setLegendPosition(position)EmbeddedLineChartBuilderSets the position of the legend with respect to the chart.
setLegendTextStyle(textStyle)EmbeddedLineChartBuilderSets the text style of the chart legend.
setOption(option, value)EmbeddedChartBuilder

Sets advanced options for this chart.

setPointStyle(style)EmbeddedLineChartBuilderSets the style for points in the line.
setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)EmbeddedChartBuilderSets the position, changing where the chart appears on the sheet.
setRange(start, end)EmbeddedLineChartBuilderSets the range for the chart.
setTitle(chartTitle)EmbeddedLineChartBuilderSets the title of the chart.
setTitleTextStyle(textStyle)EmbeddedLineChartBuilderSets the text style of the chart title.
setXAxisTextStyle(textStyle)EmbeddedLineChartBuilderSets the horizontal axis text style.
setXAxisTitle(title)EmbeddedLineChartBuilderAdds a title to the horizontal axis.
setXAxisTitleTextStyle(textStyle)EmbeddedLineChartBuilderSets the horizontal axis title text style.
setYAxisTextStyle(textStyle)EmbeddedLineChartBuilderSets the vertical axis text style.
setYAxisTitle(title)EmbeddedLineChartBuilderAdds a title to the vertical axis.
setYAxisTitleTextStyle(textStyle)EmbeddedLineChartBuilderSets the vertical axis title text style.
useLogScale()EmbeddedLineChartBuilderMakes the range axis into a logarithmic scale (requires all values to be positive).

Class EmbeddedPieChartBuilder

Methods

MethodReturn typeBrief description
addRange(range)EmbeddedChartBuilderAdds a Range to the chart represented by this builder.
asAreaChart()EmbeddedAreaChartBuilderSets the chart type to AreaChart and returns an EmbeddedAreaChartBuilder.
asBarChart()EmbeddedBarChartBuilderSets the chart type to BarChart and returns an EmbeddedBarChartBuilder.
asColumnChart()EmbeddedColumnChartBuilderSets the chart type to ColumnChart and returns an EmbeddedColumnChartBuilder.
asLineChart()EmbeddedLineChartBuilderSets the chart type to LineChart and returns an EmbeddedLineChartBuilder.
asPieChart()EmbeddedPieChartBuilderSets the chart type to PieChart and returns an EmbeddedPieChartBuilder.
asScatterChart()EmbeddedScatterChartBuilderSets the chart type to ScatterChart and returns an EmbeddedScatterChartBuilder.
asTableChart()EmbeddedTableChartBuilderSets the chart type to TableChart and returns an EmbeddedTableChartBuilder.
build()EmbeddedChartBuilds the chart to reflect all changes made to it.
getChartType()ChartTypeReturns the current chart type.
getContainer()ContainerInfoReturn the ContainerInfo, which encapsulates where the chart appears on the sheet.
getRanges()Range[]Returns a copy of the list of ranges currently providing data for this chart.
removeRange(range)EmbeddedChartBuilderRemoves the specified Range from the chart represented by this builder.
reverseCategories()EmbeddedPieChartBuilderReverses the drawing of series in the domain axis.
set3D()EmbeddedPieChartBuilderSets the chart to be three-dimensional.
setBackgroundColor(cssValue)EmbeddedPieChartBuilderSets the background color for the chart.
setChartType(type)EmbeddedChartBuilderChanges the type of chart.
setColors(cssValues)EmbeddedPieChartBuilderSets the colors for the lines in the chart.
setLegendPosition(position)EmbeddedPieChartBuilderSets the position of the legend with respect to the chart.
setLegendTextStyle(textStyle)EmbeddedPieChartBuilderSets the text style of the chart legend.
setOption(option, value)EmbeddedChartBuilder

Sets advanced options for this chart.

setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)EmbeddedChartBuilderSets the position, changing where the chart appears on the sheet.
setTitle(chartTitle)EmbeddedPieChartBuilderSets the title of the chart.
setTitleTextStyle(textStyle)EmbeddedPieChartBuilderSets the text style of the chart title.

Class EmbeddedScatterChartBuilder

Methods

MethodReturn typeBrief description
addRange(range)EmbeddedChartBuilderAdds a Range to the chart represented by this builder.
asAreaChart()EmbeddedAreaChartBuilderSets the chart type to AreaChart and returns an EmbeddedAreaChartBuilder.
asBarChart()EmbeddedBarChartBuilderSets the chart type to BarChart and returns an EmbeddedBarChartBuilder.
asColumnChart()EmbeddedColumnChartBuilderSets the chart type to ColumnChart and returns an EmbeddedColumnChartBuilder.
asLineChart()EmbeddedLineChartBuilderSets the chart type to LineChart and returns an EmbeddedLineChartBuilder.
asPieChart()EmbeddedPieChartBuilderSets the chart type to PieChart and returns an EmbeddedPieChartBuilder.
asScatterChart()EmbeddedScatterChartBuilderSets the chart type to ScatterChart and returns an EmbeddedScatterChartBuilder.
asTableChart()EmbeddedTableChartBuilderSets the chart type to TableChart and returns an EmbeddedTableChartBuilder.
build()EmbeddedChartBuilds the chart to reflect all changes made to it.
getChartType()ChartTypeReturns the current chart type.
getContainer()ContainerInfoReturn the ContainerInfo, which encapsulates where the chart appears on the sheet.
getRanges()Range[]Returns a copy of the list of ranges currently providing data for this chart.
removeRange(range)EmbeddedChartBuilderRemoves the specified Range from the chart represented by this builder.
setBackgroundColor(cssValue)EmbeddedScatterChartBuilderSets the background color for the chart.
setChartType(type)EmbeddedChartBuilderChanges the type of chart.
setColors(cssValues)EmbeddedScatterChartBuilderSets the colors for the lines in the chart.
setLegendPosition(position)EmbeddedScatterChartBuilderSets the position of the legend with respect to the chart.
setLegendTextStyle(textStyle)EmbeddedScatterChartBuilderSets the text style of the chart legend.
setOption(option, value)EmbeddedChartBuilder

Sets advanced options for this chart.

setPointStyle(style)EmbeddedScatterChartBuilderSets the style for points in the line.
setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)EmbeddedChartBuilderSets the position, changing where the chart appears on the sheet.
setTitle(chartTitle)EmbeddedScatterChartBuilderSets the title of the chart.
setTitleTextStyle(textStyle)EmbeddedScatterChartBuilderSets the text style of the chart title.
setXAxisLogScale()EmbeddedScatterChartBuilderMakes the horizontal axis into a logarithmic scale (requires all values to be positive).
setXAxisRange(start, end)EmbeddedScatterChartBuilderSets the range for the horizontal axis of the chart.
setXAxisTextStyle(textStyle)EmbeddedScatterChartBuilderSets the horizontal axis text style.
setXAxisTitle(title)EmbeddedScatterChartBuilderAdds a title to the horizontal axis.
setXAxisTitleTextStyle(textStyle)EmbeddedScatterChartBuilderSets the horizontal axis title text style.
setYAxisLogScale()EmbeddedScatterChartBuilderMakes the vertical axis into a logarithmic scale (requires all values to be positive).
setYAxisRange(start, end)EmbeddedScatterChartBuilderSets the range for the vertical axis of the chart.
setYAxisTextStyle(textStyle)EmbeddedScatterChartBuilderSets the vertical axis text style.
setYAxisTitle(title)EmbeddedScatterChartBuilderAdds a title to the vertical axis.
setYAxisTitleTextStyle(textStyle)EmbeddedScatterChartBuilderSets the vertical axis title text style.

Class EmbeddedTableChartBuilder

Methods

MethodReturn typeBrief description
addRange(range)EmbeddedChartBuilderAdds a Range to the chart represented by this builder.
asAreaChart()EmbeddedAreaChartBuilderSets the chart type to AreaChart and returns an EmbeddedAreaChartBuilder.
asBarChart()EmbeddedBarChartBuilderSets the chart type to BarChart and returns an EmbeddedBarChartBuilder.
asColumnChart()EmbeddedColumnChartBuilderSets the chart type to ColumnChart and returns an EmbeddedColumnChartBuilder.
asLineChart()EmbeddedLineChartBuilderSets the chart type to LineChart and returns an EmbeddedLineChartBuilder.
asPieChart()EmbeddedPieChartBuilderSets the chart type to PieChart and returns an EmbeddedPieChartBuilder.
asScatterChart()EmbeddedScatterChartBuilderSets the chart type to ScatterChart and returns an EmbeddedScatterChartBuilder.
asTableChart()EmbeddedTableChartBuilderSets the chart type to TableChart and returns an EmbeddedTableChartBuilder.
build()EmbeddedChartBuilds the chart to reflect all changes made to it.
enablePaging(enablePaging)EmbeddedTableChartBuilderSets whether to enable paging through the data.
enablePaging(pageSize)EmbeddedTableChartBuilderEnables paging and sets the number of rows in each page.
enablePaging(pageSize, startPage)EmbeddedTableChartBuilderEnables paging, sets the number of rows in each page and the first table page to display (page numbers are zero based).
enableRtlTable(rtlEnabled)EmbeddedTableChartBuilderAdds basic support for right-to-left languages (such as Arabic or Hebrew) by reversing the column order of the table, so that column zero is the right-most column, and the last column is the left-most column.
enableSorting(enableSorting)EmbeddedTableChartBuilderSets whether to sort columns when the user clicks a column heading.
getChartType()ChartTypeReturns the current chart type.
getContainer()ContainerInfoReturn the ContainerInfo, which encapsulates where the chart appears on the sheet.
getRanges()Range[]Returns a copy of the list of ranges currently providing data for this chart.
removeRange(range)EmbeddedChartBuilderRemoves the specified Range from the chart represented by this builder.
setChartType(type)EmbeddedChartBuilderChanges the type of chart.
setFirstRowNumber(number)EmbeddedTableChartBuilderSets the row number for the first row in the data table.
setInitialSortingAscending(column)EmbeddedTableChartBuilderSets the index of the column according to which the table should be initially sorted (ascending).
setInitialSortingDescending(column)EmbeddedTableChartBuilderSets the index of the column according to which the table should be initially sorted (descending).
setOption(option, value)EmbeddedChartBuilder

Sets advanced options for this chart.

setPosition(anchorRowPos, anchorColPos, offsetX, offsetY)EmbeddedChartBuilderSets the position, changing where the chart appears on the sheet.
showRowNumberColumn(showRowNumber)EmbeddedTableChartBuilderSets whether to show the row number as the first column of the table.
useAlternatingRowStyle(alternate)EmbeddedTableChartBuilderSets whether alternating color style will be assigned to odd and even rows of a table chart.

Class PageProtection

Methods

MethodReturn typeBrief description
addUser(email)voidAdds a user to the list of users who can edit the sheet, if it is protected.
getUsers()String[]Returns a list of the email addresses of the users who can edit this sheet.
isProtected()BooleanIndicates whether the sheet has sheet protection enabled or not.
removeUser(user)voidRemoves a user from the list of users who can edit the sheet.
setProtected(protection)voidSets the protection status for the sheet.

Class Range

Methods

MethodReturn typeBrief description
activate()RangeMake this range the active range.
breakApart()RangeBreak any multi-column cells in the range into individual cells again.
clear()RangeClears the range of contents, formats, and data-validation rules.
clear(options)RangeClears the range of contents, format, data-validation rules, and/or comments, as specified with the given advanced options.
clearContent()RangeClears the content of the range, leaving the formatting intact.
clearDataValidations()RangeClears the data-validation rules for the range.
clearFormat()RangeClears formatting for this range.
clearNote()RangeClears the note in the given cell or cells.
copyFormatToRange(gridId, column, columnEnd, row, rowEnd)voidCopy the formatting of the range to the given location.
copyFormatToRange(sheet, column, columnEnd, row, rowEnd)voidCopy the formatting of the range to the given location.
copyTo(destination)voidCopies the data from a range of cells to another range of cells.
copyTo(destination, options)voidCopies the data from a range of cells to another range of cells.
copyValuesToRange(gridId, column, columnEnd, row, rowEnd)voidCopy the content of the range to the given location.
copyValuesToRange(sheet, column, columnEnd, row, rowEnd)voidCopy the content of the range to the given location.
getA1Notation()StringReturns a string description of the range, in A1 notation.
getBackground()StringReturns the background color of the top-left cell in the range (i.e., "#ff0000").
getBackgrounds()String[][]Returns the background colors of the cells in the range (i.e., "#ff0000").
getCell(row, column)RangeReturns a given cell within a range.
getColumn()IntegerReturns the starting column position for this range.
getDataSourceUrl()StringReturns a URL for the data in this range, which can be used to create charts and queries.
getDataTable()DataTableReturn the data inside this object as a DataTable.
getDataTable(firstRowIsHeader)DataTableReturn the data inside this Range as a DataTable.
getDataValidation()DataValidationReturns the data-validation rule for the top-left cell in the range.
getDataValidations()DataValidation[][]Returns the data-validation rules for all cells in the range.
getFontColor()StringReturns the font color of the cell in the top-left corner of the range, in CSS notation (e.g.
getFontColors()String[][]Returns the font colors of the cells in the range in CSS notation (e.g.
getFontFamilies()String[][]Returns the font families of the cells in the range.
getFontFamily()StringReturns the font family of the cell in the top-left corner of the range.
getFontLine()StringGets the LineStyle of of the cell in the top-left corner of the range (underline, line-through, etc.).
getFontLines()String[][]Gets the LineStyle of of the cells in the range (underline, line-through, etc.).
getFontSize()IntegerReturns the font size in point size of the cell in the top-left corner of the range.
getFontSizes()Integer[][]Returns the font sizes of the cells in the range.
getFontStyle()StringReturns the font style (italic/normal/oblique) of the cell in the top-left corner of the range.
getFontStyles()String[][]Returns the font styles of the cells in the range.
getFontWeight()StringReturns the font weight (normal/bold) of the cell in the top-left corner of the range.
getFontWeights()String[][]Returns the font weights of the cells in the range.
getFormula()StringReturns the formula (A1 notation) for the top-left cell of the range, or an empty string if the cell is empty or doesn't contain a formula.
getFormulaR1C1()StringReturns the formula (R1C1 notation) for a given cell, or null if none.
getFormulas()String[][]Returns the formulas (A1 notation) for the cells in the range.
getFormulasR1C1()String[][]Returns the formulas (R1C1 notation) for the cells in the range.
getGridId()IntegerReturns the grid ID of the range's parent sheet.
getHeight()IntegerReturns the height of the range.
getHorizontalAlignment()StringReturns the horizontal alignment of the text (left/center/right) of the cell in the top-left corner of the range.
getHorizontalAlignments()String[][]Returns the horizontal alignments of the cells in the range.
getLastColumn()IntegerReturns the end column position.
getLastRow()IntegerReturns the end row position.
getNote()StringReturns the note associated with the given range.
getNotes()String[][]Returns the notes associated with the cells in the range.
getNumColumns()IntegerReturns the number of columns in this range.
getNumRows()IntegerReturns the number of rows in this range.
getNumberFormat()StringGet the number formatting of the top-left cell of the given range.
getNumberFormats()String[][]Returns the number formats for the cells in the range.
getRow()IntegerReturns the row position for this range.
getRowIndex()IntegerReturns the row position for this range.
getSheet()SheetReturns the sheet this range belongs to.
getValue()ObjectReturns the value of the top-left cell in the range.
getValues()Object[][]Returns the rectangular grid of values for this range.
getVerticalAlignment()StringReturns the vertical alignment (top/middle/bottom) of the cell in the top-left corner of the range.
getVerticalAlignments()String[][]Returns the vertical alignments of the cells in the range.
getWidth()IntegerReturns the width of the range in columns.
getWrap()BooleanReturns the wrapping policy of the cell in the top-left corner of the range.
getWraps()Boolean[][]Returns the wrapping policy of the cells in the range.
isBlank()BooleanReturns true if the range is totally blank.
merge()RangeMerges the cells in the range together into a single block.
mergeAcross()RangeMerge the cells in the range across the columns of the range.
mergeVertically()RangeMerges the cells in the range together.
moveTo(target)voidCut and paste (both format and values) from this range to the target range.
offset(rowOffset, columnOffset)RangeReturns a new range that is offset from this range by the given number of rows and columns (which can be negative).
offset(rowOffset, columnOffset, numRows)RangeReturns a new range that is relative to the current range, whose upper left point is offset from the current range by the given rows and columns, and with the given height in cells.
offset(rowOffset, columnOffset, numRows, numColumns)RangeReturns a new range that is relative to the current range, whose upper left point is offset from the current range by the given rows and columns, and with the given height and width in cells.
setBackground(color)RangeSets the background color of all cells in the range in CSS notation (e.g.
setBackgroundRGB(red, green, blue)RangeSets the background to the given RGB color.
setBackgrounds(color)RangeSets a rectangular grid of background colors (must match dimensions of this range).
setBorder(top, left, bottom, right, vertical, horizontal)RangeSets the border property.
setDataValidation(rule)RangeSets one data-validation rule for all cells in the range.
setDataValidations(rules)RangeSets the data-validation rules for all cells in the range.
setFontColor(color)RangeSets the font color in CSS notation (e.g.
setFontColors(colors)RangeSets a rectangular grid of font colors (must match dimensions of this range).
setFontFamilies(fontFamilies)RangeSets a rectangular grid of font families (must match dimensions of this range).
setFontFamily(fontFamily)RangeSets the font family, such as "Arial" or "Helvetica".
setFontLine(fontLine)RangeSets the LineStyle of the given range (underline, line-through, etc.).
setFontLines(fontLines)RangeSets a rectangular grid of font lines (must match dimensions of this range).
setFontSize(size)RangeSets the font size, with the size being the point size to use.
setFontSizes(sizes)RangeSets a rectangular grid of font sizes (must match dimensions of this range).
setFontStyle(fontStyle)RangeSet the font style for the given range (italic/normal/oblique).
setFontStyles(fontStyles)RangeSets a rectangular grid of font styles (must match dimensions of this range).
setFontWeight(fontWeight)RangeSet the font weight for the given range (normal/bold).
setFontWeights(fontWeights)RangeSets a rectangular grid of font weights (must match dimensions of this range).
setFormula(formula)RangeUpdates the formula for this range.
setFormulaR1C1(formula)RangeUpdates the formula for this range.
setFormulas(formulas)RangeSets a rectangular grid of formulas (must match dimensions of this range).
setFormulasR1C1(formulas)RangeSets a rectangular grid of formulas (must match dimensions of this range).
setHorizontalAlignment(alignment)RangeSet the horizontal (left to right) alignment for the given range (left/center/right).
setHorizontalAlignments(alignments)RangeSets a rectangular grid of horizontal alignments.
setNote(note)RangeSets the note to the given value.
setNotes(notes)RangeSets a rectangular grid of notes (must match dimensions of this range).
setNumberFormat(numberFormat)RangeSets the number or date format to the given formatting string.
setNumberFormats(numberFormats)RangeSets a rectangular grid of number or date formats (must match dimensions of this range).
setValue(value)RangeSets the value of the range.
setValues(values)RangeSets a rectangular grid of values (must match dimensions of this range).
setVerticalAlignment(alignment)RangeSet the vertical (top to bottom) alignment for the given range (top/middle/bottom).
setVerticalAlignments(alignments)RangeSets a rectangular grid of vertical alignments (must match dimensions of this range).
setWrap(isWrapEnabled)RangeSet the cell wrap of the given range.
setWraps(isWrapEnabled)RangeSets a rectangular grid of word wrap policies (must match dimensions of this range).
sort(sortSpecObj)RangeSorts the cells in the given range.

Class Sheet

Methods

MethodReturn typeBrief description
activate()SheetActivates this sheet.
appendRow(rowContents)SheetAppends a row to the spreadsheet.
autoResizeColumn(columnPosition)SheetSets the width of the given column to fit its contents
clear()SheetClears the sheet of content and formatting information.
clear(options)SheetClears the sheet of contents and/or format, as specified with the given advanced options.
clearContents()SheetClears the sheet of contents, while preserving formatting information.
clearFormats()SheetClears the sheet of formatting, while preserving contents.
clearNotes()SheetClears the sheet of all notes.
copyTo(spreadsheet)SheetCopies the sheet to another spreadsheet.
deleteColumn(columnPosition)SheetDeletes the column at the given column position.
deleteColumns(columnPosition, howMany)voidDeletes a number of columns starting at the given column position.
deleteRow(rowPosition)SheetDeletes the row at the given row position.
deleteRows(rowPosition, howMany)voidDeletes a number of rows starting at the given row position.
getActiveCell()RangeReturns the active cell in this sheet.
getActiveRange()RangeReturns the active range for the active sheet.
getCharts()EmbeddedChart[]Returns an array of charts on this sheet.
getColumnWidth(columnPosition)IntegerGets the width in pixels of the given column.
getDataRange()RangeReturns a Range corresponding to the dimensions in which data is present.
getFrozenColumns()IntegerReturns the number of frozen columns.
getFrozenRows()IntegerReturns the number of frozen rows.
getIndex()IntegerGets the position of the sheet in its parent spreadsheet.
getLastColumn()IntegerReturns the position of the last column that has content.
getLastRow()IntegerReturns the position of the last row that has content.
getMaxColumns()IntegerThe maximum width of the sheet, regardless of content.
getMaxRows()IntegerThe maximum height of the sheet, regardless of content.
getName()StringReturns the name of the sheet.
getParent()SpreadsheetReturns the Spreadsheet that contains this sheet.
getRange(row, column)RangeReturns the range with the top left cell at the given coordinates.
getRange(row, column, numRows)RangeReturns the range with the top left cell at the given coordinates, and with the given number of rows.
getRange(row, column, numRows, numColumns)RangeReturns the range with the top left cell at the given coordinates with the given number of rows and columns.
getRange(a1Notation)RangeReturns the range as specified in A1 notation or R1C1 notation.
getRowHeight(rowPosition)IntegerGets the height in pixels of the given row.
getSheetId()IntegerReturns the ID of the sheet represented by this object.
getSheetName()StringReturns the sheet name.
getSheetProtection()PageProtectionReturns a PageProtection instance describing the permissions for the current sheet.
getSheetValues(startRow, startColumn, numRows, numColumns)Object[][]Returns the rectangular grid of values for this range starting at the given coordinates.
hideColumn(column)voidHides the columns in the given range.
hideColumns(columnIndex)voidHides the column at the given index.
hideColumns(columnIndex, numColumns)voidHides one or more consecutive columns starting at the given index.
hideRow(row)voidHides the rows in the given range.
hideRows(rowIndex)voidHides the row at the given index.
hideRows(rowIndex, numRows)voidHides one or more consecutive rows starting at the given index.
hideSheet()SheetHides this sheet.
insertChart(chart)voidAdds a new chart to this sheet.
insertColumnAfter(afterPosition)SheetInserts a column after the given column position.
insertColumnBefore(beforePosition)SheetInserts a column before the given column position.
insertColumns(columnIndex)voidInserts a blank column in a sheet at the specified location.
insertColumns(columnIndex, numColumns)voidInserts one or more consecutive blank columns in a sheet starting at the specified location.
insertColumnsAfter(afterPosition, howMany)SheetInserts a number of columns after the given column position.
insertColumnsBefore(beforePosition, howMany)SheetInserts a number of columns before the given column position.
insertImage(url, column, row)voidInserts an image in the document at a given row and column.
insertImage(url, column, row, offsetX, offsetY)voidInserts an image in the document at a given row and column with a pixel offset.
insertRowAfter(afterPosition)SheetInserts a row after the given row position.
insertRowBefore(beforePosition)SheetInserts a row before the given row position.
insertRows(rowIndex)voidInserts a blank row in a sheet at the specified location.
insertRows(rowIndex, numRows)voidInserts one or more consecutive blank rows in a sheet starting at the specified location.
insertRowsAfter(afterPosition, howMany)SheetInserts a number of rows after the given row position.
insertRowsBefore(beforePosition, howMany)SheetInserts a number of rows before the given row position.
isSheetHidden()BooleanReturns true if the sheet is currently hidden.
newChart()EmbeddedChartBuilderReturns a builder to create a new chart for this sheet.
removeChart(chart)voidRemoves a chart from the parent sheet.
setActiveRange(range)RangeSets the active range for the active sheet.
setActiveSelection(range)RangeSets the active selection region for this sheet.
setActiveSelection(a1Notation)RangeSets the active selection, as specified in A1 notation or R1C1 notation.
setColumnWidth(columnPosition, width)SheetSets the width of the given column in pixels.
setFrozenColumns(columns)voidFreezes the given number of columns.
setFrozenRows(rows)voidFreezes the given number of rows.
setName(name)SheetSets the sheet name.
setRowHeight(rowPosition, height)SheetSets the row height of the given row in pixels.
setSheetProtection(permissions)voidSets the permissions for the current sheet.
showColumns(columnIndex)voidUnhides the column at the given index.
showColumns(columnIndex, numColumns)voidUnhides one or more consecutive columns starting at the given index.
showRows(rowIndex)voidUnhides the row at the given index.
showRows(rowIndex, numRows)voidUnhides one or more consecutive rows starting at the given index.
showSheet()SheetMakes the sheet visible.
sort(columnPosition)SheetSorts a sheet by column, ascending.
sort(columnPosition, ascending)SheetSorts a sheet by column.
unhideColumn(column)voidUnhides the column in the given range.
unhideRow(row)voidUnhides the row in the given range.
updateChart(chart)voidUpdates the chart on this sheet.

Class Spreadsheet

Methods

MethodReturn typeBrief description
addEditor(emailAddress)voidAdds the given user to the list of editors for the Spreadsheet.
addEditor(user)voidAdds the given user to the list of editors for the Spreadsheet.
addEditors(emailAddresses)voidAdds the given array of users to the list of editors for the Spreadsheet.
addMenu(name, subMenus)voidCreates a new menu in the Spreadsheet UI.
addViewer(emailAddress)voidAdds the given user to the list of viewers for the Spreadsheet.
addViewer(user)voidAdds the given user to the list of viewers for the Spreadsheet.
addViewers(emailAddresses)voidAdds the given array of users to the list of viewers for the Spreadsheet.
appendRow(rowContents)SheetAppends a row to the spreadsheet.
autoResizeColumn(columnPosition)SheetSets the width of the given column to fit its contents
copy(name)SpreadsheetCopies the spreadsheet and returns the new one.
deleteActiveSheet()SheetDeletes the currently active sheet.
deleteColumn(columnPosition)SheetDeletes the column at the given column position.
deleteColumns(columnPosition, howMany)voidDeletes a number of columns starting at the given column position.
deleteRow(rowPosition)SheetDeletes the row at the given row position.
deleteRows(rowPosition, howMany)voidDeletes a number of rows starting at the given row position.
deleteSheet(sheet)voidDeletes the specified sheet.
duplicateActiveSheet()SheetDuplicates the active sheet and makes it the active sheet.
getActiveCell()RangeReturns the active cell in this sheet.
getActiveRange()RangeReturns the active range for the active sheet.
getActiveSheet()SheetGets the active sheet in a spreadsheet.
getColumnWidth(columnPosition)IntegerGets the width in pixels of the given column.
getDataRange()RangeReturns a Range corresponding to the dimensions in which data is present.
getEditors()User[]Gets the list of editors for this Spreadsheet.
getFormUrl()StringReturns the url for the form attached to the spreadsheet, null if there is no form.
getFrozenColumns()IntegerReturns the number of frozen columns.
getFrozenRows()IntegerReturns the number of frozen rows.
getId()StringGets a unique identifier for this spreadsheet.
getLastColumn()IntegerReturns the position of the last column that has content.
getLastRow()IntegerReturns the position of the last row that has content.
getName()StringGets the name of the document.
getNumSheets()IntegerReturns the number of sheets in this spreadsheet.
getOwner()UserReturns the owner of the document.
getRange(a1Notation)RangeReturns the range as specified in A1 notation or R1C1 notation.
getRangeByName(name)RangeReturns a named range, or null if no range with the given name is found.
getRowHeight(rowPosition)IntegerGets the height in pixels of the given row.
getSheetByName(name)SheetReturns a sheet with the given name.
getSheetId()IntegerReturns the ID of the sheet represented by this object.
getSheetName()StringReturns the sheet name.
getSheetProtection()PageProtectionReturns a PageProtection instance describing the permissions for the current sheet.
getSheetValues(startRow, startColumn, numRows, numColumns)Object[][]Returns the rectangular grid of values for this range starting at the given coordinates.
getSheets()Sheet[]Gets all the sheets in this spreadsheet.
getSpreadsheetLocale()StringGets the spreadsheet locale.
getSpreadsheetTimeZone()StringGets the time zone for the spreadsheet.
getUrl()StringReturns the url for the given spreadsheet.
getViewers()User[]Gets the list of viewers and commenters for this Spreadsheet.
hideColumn(column)voidHides the columns in the given range.
hideRow(row)voidHides the rows in the given range.
insertColumnAfter(afterPosition)SheetInserts a column after the given column position.
insertColumnBefore(beforePosition)SheetInserts a column before the given column position.
insertColumnsAfter(afterPosition, howMany)SheetInserts a number of columns after the given column position.
insertColumnsBefore(beforePosition, howMany)SheetInserts a number of columns before the given column position.
insertImage(url, column, row)voidInserts an image in the document at a given row and column.
insertImage(url, column, row, offsetX, offsetY)voidInserts an image in the document at a given row and column with a pixel offset.
insertRowAfter(afterPosition)SheetInserts a row after the given row position.
insertRowBefore(beforePosition)SheetInserts a row before the given row position.
insertRowsAfter(afterPosition, howMany)SheetInserts a number of rows after the given row position.
insertRowsBefore(beforePosition, howMany)SheetInserts a number of rows before the given row position.
insertSheet()SheetInserts a new sheet in the spreadsheet, with a default name.
insertSheet(sheetIndex)SheetInserts a new sheet in the spreadsheet at the given index.
insertSheet(sheetIndex, options)SheetInserts a new sheet in the spreadsheet at the given index and uses optional advanced arguments.
insertSheet(options)SheetInserts a new sheet in the spreadsheet, with a default name and uses optional advanced arguments.
insertSheet(sheetName)SheetInserts a new sheet in the spreadsheet with the given name.
insertSheet(sheetName, sheetIndex)SheetInserts a new sheet in the spreadsheet with the given name at the given index.
insertSheet(sheetName, sheetIndex, options)SheetInserts a new sheet in the spreadsheet with the given name at the given index and uses optional advanced arguments.
insertSheet(sheetName, options)SheetInserts a new sheet in the spreadsheet with the given name and uses optional advanced arguments.
moveActiveSheet(pos)voidMoves the active sheet to the given position in the list of sheets.
removeEditor(emailAddress)voidRemoves the given user from the list of editors for the Spreadsheet.
removeEditor(user)voidRemoves the given user from the list of editors for the Spreadsheet.
removeMenu(name)voidRemoves a menu that was added by addMenu(name, subMenus).
removeNamedRange(name)voidDeletes a named range with the given name.
removeViewer(emailAddress)voidRemoves the given user from the list of viewers and commenters for the Spreadsheet.
removeViewer(user)voidRemoves the given user from the list of viewers and commenters for the Spreadsheet.
rename(newName)voidRenames the document.
renameActiveSheet(newName)voidRenames the current active sheet to the given new name.
setActiveRange(range)RangeSets the active range for the active sheet.
setActiveSelection(range)RangeSets the active selection region for this sheet.
setActiveSelection(a1Notation)RangeSets the active selection, as specified in A1 notation or R1C1 notation.
setActiveSheet(sheet)SheetSets the given sheet to be the active sheet in the spreadsheet.
setColumnWidth(columnPosition, width)SheetSets the width of the given column in pixels.
setFrozenColumns(columns)voidFreezes the given number of columns.
setFrozenRows(rows)voidFreezes the given number of rows.
setNamedRange(name, range)voidNames a range.
setRowHeight(rowPosition, height)SheetSets the row height of the given row in pixels.
setSheetProtection(permissions)voidSets the permissions for the current sheet.
setSpreadsheetLocale(locale)voidSets the spreadsheet locale.
setSpreadsheetTimeZone(timezone)voidSets the time zone for the spreadsheet.
show(userInterface)voidDisplays a custom user interface component in a dialog centered in the user's browser's viewport.
sort(columnPosition)SheetSorts a sheet by column, ascending.
sort(columnPosition, ascending)SheetSorts a sheet by column.
toast(msg)voidShows a popup window in the lower right corner of the spreadsheet with the given message.
toast(msg, title)voidShows a popup window in the lower right corner of the spreadsheet with the given message and title.
toast(msg, title, timeoutSeconds)voidShows a popup window in the lower right corner of the spreadsheet with the given title and message, that stays visible for a certain length of time.
unhideColumn(column)voidUnhides the column in the given range.
unhideRow(row)voidUnhides the row in the given range.
updateMenu(name, subMenus)voidUpdates a menu that was added by addMenu(name, subMenus).

Class SpreadsheetApp

Properties

PropertyTypeDescription
DataValidationCriteriaDataValidationCriteriaAn enumeration representing the data-validation criteria that can be set on a range.

Methods

MethodReturn typeBrief description
create(name)SpreadsheetCreates a new spreadsheet with the given name.
create(name, rows, columns)SpreadsheetCreates a new spreadsheet with the given name and the specified number of rows and columns.
flush()voidApplies all pending Spreadsheet changes.
getActive()SpreadsheetReturns the currently active spreadsheet, or null if there is none.
getActiveRange()RangeReturns the range of cells that is currently considered active.
getActiveSheet()SheetGets the active sheet in a spreadsheet.
getActiveSpreadsheet()SpreadsheetReturns the currently active spreadsheet, or null if there is none.
getUi()UiReturns an instance of the spreadsheet's user-interface environment that allows the script to add features like menus, dialogs, and sidebars.
newDataValidation()DataValidationBuilderCreates a builder for a data-validation rule.
open(file)SpreadsheetOpens the spreadsheet that corresponds to the given File object.
openById(id)SpreadsheetOpens the spreadsheet with the given ID.
openByUrl(url)SpreadsheetOpens the spreadsheet with the given url.
setActiveRange(range)RangeSets the active range for the application.
setActiveSheet(sheet)SheetSets the active sheet in a spreadsheet.
setActiveSpreadsheet(newActiveSpreadsheet)voidSets the active spreadsheet.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.