Stay organized with collections Save and categorize content based on your preferences.
DataSourceSheetAccess and modify existing data source sheet. To create a new data source sheet, use Spreadsheet.insertDataSourceSheet(spec)
.
Only use this class with data that's connected to a database.
Detailed documentationaddFilter(columnName, filterCriteria)
Adds a filter applied to the data source sheet.
Parameters Name Type DescriptioncolumnName
String
The name of the column to apply this filter to. filterCriteria
FilterCriteria
The filter criteria to apply. Return
DataSourceSheet
— The data source sheet, for method chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
asSheet()
Returns the data source sheet as a regular sheet object.
ReturnSheet
— The regular sheet.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
autoResizeColumn(columnName)
Auto resizes the width of the specified column.
Parameters Name Type DescriptioncolumnName
String
The column name. Return
DataSourceSheet
— This data source sheet, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
autoResizeColumns(columnNames)
Auto resizes the width of the specified columns.
Parameters Name Type DescriptioncolumnNames
String[]
The list of column names to update. Return
DataSourceSheet
— This data source sheet, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
cancelDataRefresh()
Cancels the data refresh associated with this object if it's currently running.
This example shows how to cancel a formula refresh.
const spreadsheet = SpreadsheetApp.getActive(); const formula = spreadsheet.getDataSourceFormulas()[0]; // Cancel the ongoing refresh on the formula. formula.cancelDataRefresh();
Throws an exception if the data source type is not enabled. Use SpreadsheetApp#enable...Execution()
methods to enable data execution for specific data source type.
DataSourceSheet
— The data object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
forceRefreshData()
Refreshes the data of this object regardless of the current state. See refreshData()
for more details. If you want to cancel a currently running refresh of this object, see cancelDataRefresh()
.
Throws an exception if the data source type is not enabled. Use SpreadsheetApp#enable...Execution()
methods to enable data execution for specific data source type.
DataSourceSheet
— The data object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getColumnWidth(columnName)
Returns the width of the specified column.
Parameters Name Type DescriptioncolumnName
String
The column name. Return
Integer
— The column's width, or null
if the column uses the default width.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getDataSource()
Gets the data source the object is linked to.
ReturnDataSource
— The data source.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getFilters()
Returns all filters applied to the data source sheet.
ReturnDataSourceSheetFilter[]
— An array of all filters applied to the data source sheet.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getSheetValues(columnName)
Returns all the values for the data source sheet for the provided column name.
Parameters Name Type DescriptioncolumnName
String
The data source column name to fetch values for. Return
Object[]
— A one-dimensional array of values.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getSheetValues(columnName, startRow, numRows)
Returns all the values for the data source sheet for the provided column name from the provided start row (based-1) and up to the provided numRows
.
columnName
String
The data source column name to fetch values for. startRow
Integer
The row position to start fetching values from. numRows
Integer
The number of rows to fetch. Return
Object[]
— A one-dimensional array of values.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getSortSpecs()
Gets all the sort specs in the data source sheet.
ReturnSortSpec[]
— A list of sort specs.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
getStatus()
Gets the data execution status of the object.
ReturnDataExecutionStatus
— The data execution status.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
refreshData()
Refreshes the data of the object.
Throws an exception if currently in error
state. Use DataSource#updateSpec()
to update the specification. The method is preferred over forceRefreshData()
to prevent unexpected edits on data source.
Throws an exception if the data source type is not enabled. Use SpreadsheetApp#enable...Execution()
methods to enable data execution for specific data source type.
DataSourceSheet
— The data object.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
removeFilters(columnName)
Removes all filters applied to the data source sheet column.
Parameters Name Type DescriptioncolumnName
String
The name of the column to remove filters from. Return
DataSourceSheet
— The data source sheet, for method chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
removeSortSpec(columnName)
Removes the sort spec on a column in the data source sheet.
Parameters Name Type DescriptioncolumnName
String
The name of the column. Return
DataSourceSheet
— The data source sheet, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setColumnWidth(columnName, width)
Sets the width of the specified column.
Parameters Name Type DescriptioncolumnName
String
The column name. width
Integer
The new width for the column. Return
DataSourceSheet
— This data source sheet, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setColumnWidths(columnNames, width)
Sets the width of the specified columns.
Parameters Name Type DescriptioncolumnNames
String[]
The list of column names to update. width
Integer
The new width for the columns. Return
DataSourceSheet
— This data source sheet, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setSortSpec(columnName, ascending)
Sets the sort spec on a column in the data source sheet.
Parameters Name Type DescriptioncolumnName
String
The name of the column to sort. ascending
Boolean
If true
, sort the column in ascending order; if false
, sort the column in descending order. Return
DataSourceSheet
— The data source sheet, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
setSortSpec(columnName, sortOrder)
Sets the sort spec on a column in the data source sheet.
Parameters Name Type DescriptioncolumnName
String
The name of the column to sort. sortOrder
SortOrder
The sort order. Return
DataSourceSheet
— The data source sheet, for chaining.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
waitForCompletion(timeoutInSeconds)
Waits until the current execution completes, timing out after the provided number of seconds. Throws an exception if the execution is not completed when timing out, but does not cancel the data execution.
Parameters Name Type DescriptiontimeoutInSeconds
Integer
The time to wait for data execution, in seconds. The maximum is 300 seconds. Return
DataExecutionStatus
— The data execution status.
Scripts that use this method require authorization with one or more of the following scopes:
https://www.googleapis.com/auth/spreadsheets.currentonly
https://www.googleapis.com/auth/spreadsheets
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-03 UTC."],[[["DataSourceSheet allows access and modification of existing data source sheets connected to databases."],["It provides methods to manage filters, sorting, data refresh, column resizing, and retrieving sheet values."],["Use `Spreadsheet.insertDataSourceSheet(spec)` to create a new data source sheet."],["This class is exclusively for data linked to a database and offers various methods for manipulating and interacting with that data within a spreadsheet."]]],["DataSourceSheet manages sheets connected to a database. Key actions include: adding/removing filters and sort specifications, setting column widths, and resizing columns. It retrieves data source details, column values, and filters. Data can be refreshed or cancelled and the current data execution status can be checked. Sheets can be retrieved as regular sheet objects. There is an ability to wait for completion of an execution. New data source sheets can be created with `Spreadsheet.insertDataSourceSheet(spec)`.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4