[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 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`"]]