Class DataSourceColumn
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
DataSourceColumn
Accedere a una colonna dell'origine dati e modificarla.
Utilizza questa classe solo con dati collegati a un database.
Documentazione dettagliata
getDataSource()
Recupera l'origine dati associata alla colonna dell'origine dati.
Invio
DataSource
: l'origine dati.
Autorizzazione
Gli script che utilizzano questo metodo richiedono l'autorizzazione con uno o più dei seguenti ambiti:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getName()
Recupera il nome della colonna dell'origine dati.
Invio
String
: il nome della colonna.
Autorizzazione
Gli script che utilizzano questo metodo richiedono l'autorizzazione con uno o più dei seguenti ambiti:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
hasArrayDependency()
Restituisce se la colonna ha una dipendenza dall'array.
Invio
Boolean
: true
se la colonna ha una dipendenza da array o false
in caso contrario.
Autorizzazione
Gli script che utilizzano questo metodo richiedono l'autorizzazione con uno o più dei seguenti ambiti:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
isCalculatedColumn()
Restituisce se la colonna è una colonna calcolata.
Invio
Boolean
: true
se la colonna è una colonna calcolata o false
in caso contrario.
Autorizzazione
Gli script che utilizzano questo metodo richiedono l'autorizzazione con uno o più dei seguenti ambiti:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
remove()
Rimuove la colonna dell'origine dati.
Supportato solo per calculated columns
.
Autorizzazione
Gli script che utilizzano questo metodo richiedono l'autorizzazione con uno o più dei seguenti ambiti:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setName(name)
Imposta il nome della colonna dell'origine dati.
Supportato solo per calculated columns
.
Parametri
Nome | Tipo | Descrizione |
name | String | Il nome da impostare. |
Invio
DataSourceColumn
: la colonna dell'origine dati per l'accodamento.
Autorizzazione
Gli script che utilizzano questo metodo richiedono l'autorizzazione con uno o più dei seguenti ambiti:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 2025-07-26 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eDataSourceColumn\u003c/code\u003e class allows you to programmatically access and modify data source columns connected to a database in Google Sheets.\u003c/p\u003e\n"],["\u003cp\u003eYou can get and set the formula and name for calculated columns, as well as get the associated data source and check for array dependencies.\u003c/p\u003e\n"],["\u003cp\u003eThis class provides methods for checking if a column is calculated or has array dependencies, along with the ability to remove calculated columns.\u003c/p\u003e\n"],["\u003cp\u003eAll methods within the \u003ccode\u003eDataSourceColumn\u003c/code\u003e class require authorization with specific Google Sheets scopes.\u003c/p\u003e\n"]]],[],null,["# Class DataSourceColumn\n\nDataSourceColumn\n\nAccess and modify a data source column.\n\n\n**Only use this class with data that's connected to a database.** \n\n### Methods\n\n| Method | Return type | Brief description |\n|-----------------------------------------------|--------------------------------------------------------------|--------------------------------------------------------------|\n| [getDataSource()](#getDataSource()) | [DataSource](/apps-script/reference/spreadsheet/data-source) | Gets the data source associated with the data source column. |\n| [getFormula()](#getFormula()) | `String` | Gets the formula for the data source column. |\n| [getName()](#getName()) | `String` | Gets the name for the data source column. |\n| [hasArrayDependency()](#hasArrayDependency()) | `Boolean` | Returns whether the column has an array dependency. |\n| [isCalculatedColumn()](#isCalculatedColumn()) | `Boolean` | Returns whether the column is a calculated column. |\n| [remove()](#remove()) | `void` | Removes the data source column. |\n| [setFormula(formula)](#setFormula(String)) | [DataSourceColumn](#) | Sets the formula for the data source column. |\n| [setName(name)](#setName(String)) | [DataSourceColumn](#) | Sets the name of the data source column. |\n\nDetailed documentation\n----------------------\n\n### `get``Data``Source()`\n\nGets the data source associated with the data source column.\n\n#### Return\n\n\n[DataSource](/apps-script/reference/spreadsheet/data-source) --- The data source.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `get``Formula()`\n\nGets the formula for the data source column. Returns an empty string if the data source column\nis not a [calculated column](#isCalculatedColumn()).\n\n#### Return\n\n\n`String` --- The formula.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `get``Name()`\n\nGets the name for the data source column.\n\n#### Return\n\n\n`String` --- The column name.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `has``Array``Dependency()`\n\nReturns whether the column has an array dependency.\n\n#### Return\n\n\n`Boolean` --- `true` if the column has an array dependency, or `false` otherwise.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `is``Calculated``Column()`\n\nReturns whether the column is a calculated column.\n\n#### Return\n\n\n`Boolean` --- `true` if the column is a calculated column, or `false` otherwise.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `remove()`\n\nRemoves the data source column.\n\nOnly supported for [calculated columns](#isCalculatedColumn()).\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `set``Formula(formula)`\n\nSets the formula for the data source column.\n\nOnly supported for [calculated columns](#isCalculatedColumn()).\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------|----------|------------------|\n| `formula` | `String` | The new formula. |\n\n#### Return\n\n\n[DataSourceColumn](#) --- The data source column, for chaining.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `set``Name(name)`\n\nSets the name of the data source column.\n\nOnly supported for [calculated columns](#isCalculatedColumn()).\n\n#### Parameters\n\n| Name | Type | Description |\n|--------|----------|------------------|\n| `name` | `String` | The name to set. |\n\n#### Return\n\n\n[DataSourceColumn](#) --- The data source column, for chaining.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`"]]