diff --git a/_snippets/integrations/builtin/app-nodes/googlesheets/node-options.md b/_snippets/integrations/builtin/app-nodes/googlesheets/node-options.md new file mode 100644 index 000000000..1d93f7830 --- /dev/null +++ b/_snippets/integrations/builtin/app-nodes/googlesheets/node-options.md @@ -0,0 +1,14 @@ +- **Cell Format**: Use this option to choose how to format the data in cells. Refer to [Google Sheets API | CellFormat](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#CellFormat){:target=_blank .external-link} for more information. + - **Let Google Sheets format** (default): n8n formats text and numbers in the cells according to Google Sheets' default settings. + - **Let n8n format**: New cells in your sheet will have the same data types as the input data provided by n8n. +- **Data Location on Sheet**: Use this option when you need to specify the data range on your sheet. + - **Header Row**: Specify the row index that contains the column headers. + - **First Data Row**: Specify the row index where the actual data starts. +- **Handling extra fields in input**: When using **Mapping Column Mode > Map Automatically**, use this option to decide how to handle fields in the input data that don't match any existing columns in the sheet. + - **Insert in New Column(s)** (default): Adds new columns for any extra data. + - **Ignore Them**: Ignores extra data that don't match the existing columns. + - **Error**: Throws an error and stops execution. +- **Use Append**: Turn on this option to use the [Google API append endpoint](https://developers.google.com/sheets/api/guides/values#append_values){:target=_blank .external-link} for adding new data rows. + - By default, n8n appends empty rows or columns and then adds the new data. This approach can ensure data alignment but may be less efficient. Using the append endpoint can lead to better performance by minimizing the number of API calls and simplifying the process. But if the existing sheet data has inconsistencies such as gaps or breaks between rows and columns, n8n may add the new data in the wrong place, leading to misalignment issues. + - Use this option when performance is a priority and the data structure in the sheet is consistent without gaps. + diff --git a/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets.md b/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets.md deleted file mode 100644 index b1490c110..000000000 --- a/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets.md +++ /dev/null @@ -1,130 +0,0 @@ ---- -#https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4 -title: Google Sheets node documentation -description: Learn how to use the Google Sheets node in n8n. Follow technical documentation to integrate Google Sheets node into your workflows. -contentType: integration -priority: critical ---- - -# Google Sheets node - -Use the Google Sheets node to automate work in Google Sheets, and integrate Google Sheets with other applications. n8n has built-in support for a wide range of Google Sheets features, including creating, updating, deleting, appending, removing and getting documents. - -On this page, you'll find a list of operations the Google Sheets node supports and links to more resources. - -/// note | Credentials -Refer to [Google Sheets credentials](/integrations/builtin/credentials/google/) for guidance on setting up authentication. -/// - -## Operations - -* Document - * Create - * Delete -* Sheet within document - * Append or Update Row: append a new row, or update the current one if it already exists. - * Append Row: create a new row. - * Clear: clear all data from a sheet - * Create: create a new sheet - * Delete: delete a sheet - * Delete Rows or Columns: delete columns and rows from a sheet - * Get Many Rows: read all rows in a sheet. - * Update Row: update rows in a sheet - -## Templates and examples - - -[[ templatesWidget(title, 'google-sheets') ]] - -## Related resources - -Refer to [Google Sheet's API documentation](https://developers.google.com/sheets/api){:target=_blank .external-link} for more information about the service. - ---8<-- "_snippets/integrations/builtin/app-nodes/operation-not-supported.md" - -## Update operations - -To update data in a sheet: - -1. Select your **Authentication** method and credential. Refer to [Google credentials](/integrations/builtin/credentials/google/) for more information. -2. In **Resource**, select **Sheet Within Document**. -3. In **Operation**, select one of the append operations. -4. Choose the **Document** and **Sheet** you want to edit. -5. Choose your **Data Mode**: - * **Map Automatically**: use this when the table column names (or JSON parameter names) in the node input view match the column names in your spreadsheet. In **Column to Match On**, select the column name in Google Sheets that you want to map to. - * **Map Each Column Manually**: use this when the column names and data structure in your node input data doesn't match the names and structure in Google Sheets. - 1. In **Column to Match On**, select or enter the column name in Google Sheets. - 2. In the first field in **Value to Update**, drag in the table column (or JSON parameter) whose value you want to search for. - 3. In the second field of **Values to Update**, drag in the value you want to add. - - ??? Details "View example and screenshots" - This example uses the Customer Datastore node to provide sample data to load into Google Sheets. It assumes you've already set up your [credentials](/integrations/builtin/credentials/google/). - - 1. Set up a Google Sheet with two columns, `test1` and `test`. In `test1`, enter the names from the Customer Datastore node: - ![The spreadsheet set up for testing](/_images/integrations/builtin/app-nodes/googlesheets/test-sheet-before.png) - 2. Create the workflow: use the manual trigger, Customer Datastore, and Google Sheets nodes. - ![The spreadsheet set up for testing](/_images/integrations/builtin/app-nodes/googlesheets/workflow.png) - 3. Open the Customer Datastore node, enable **Return All**, then select **Test step**. - 4. In the Google Sheets node, go through the steps above, using these settings: - * Select **Update Row** as the **Operation**. - * In **Column to Match On**, select `test1`. - * For the first field of **Values to Update**, drag in the **name** from the input view. - * For the second field of **Values to Update**, drag in the **email** from the input view. - 5. Select **Test step**. - 6. View your spreadsheet. **test2** should now contain the email addresses that match to the names in the input data. - ![The spreadsheet set up for testing](/_images/integrations/builtin/app-nodes/googlesheets/test-sheet-after.png) - - * **Nothing**: don't map any data. - - -## Read operations - -To read from a sheet: - -1. Select your **Authentication** method and credential. Refer to [Google credentials](/integrations/builtin/credentials/google/) for more information. -2. In **Resource**, select **Sheet Within Document**. -3. In **Operation**, select **Get Many Rows**. -4. Choose the **Document** and **Sheet** you want to read from. - -/// note | First row -n8n treats the first row in a Google Sheet as a heading row, and doesn't return it when reading all rows. If you want to read the first row, use the **Options** to set **Data Location on Sheet**. -/// -### Filters - -By default, the Google Sheets node reads and returns all rows in the sheet. To return a limited set of results: - -1. Select **Add Filter**. -2. In **Column**, select the column in your sheet to search against. -3. In **Value**, enter a cell value to search for. You can drag input data parameters here. - -If your filter matches multiple rows, n8n returns the first result. If you want all matching rows: - -1. Under **Options**, select **Add Option** > **When Filter Has Multiple Matches**. -2. Change **When Filter Has Multiple Matches** to **Return All Matches**. - -### Output formatting - -You can choose how n8n formats the data returned by Google Sheets: - -1. After setting up the node to read rows, select **Add Option** > **Output Formatting**. -2. In **General Formatting**, choose one of: - * **Values (unformatted)**: numbers stay as numbers, but n8n removes currency signs and other special formatting. - * **Values (formatted)**: n8n displays the values as they appear in Google Sheets (for example, retaining commas or currency signs) To do this, n8n converts the data type from number to string. - * **Formulas**: n8n returns the formula. It doesn't calculate the formula output. For example, if a cell B2 has the formula `=A2`, n8n returns B2's value as `=A2` (in text). -3. Choose your preferred **Date Formatting**. - -## Append an array - -To insert an array of data into Google Sheets, you must convert the data into a valid JSON (key, value) format. You can use the [Code node](/integrations/builtin/core-nodes/n8n-nodes-base.code/) to convert the array into JSON format. - -## Cell formatting for update and append - -You can choose how to format the data in cells: - -1. After setting up the node to append data, select **Add Option** > **Cell Format**. -2. In **Cell Format**, select one of: - * **Let n8n format**: the new cells in your sheet keep the data type of the data in n8n. - * **Let Google Sheets format**: allow Google Sheets to style the cells as if you typed the data directly into the cells. - - - diff --git a/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/document-operations.md b/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/document-operations.md new file mode 100644 index 000000000..6d15cd332 --- /dev/null +++ b/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/document-operations.md @@ -0,0 +1,50 @@ +--- +#https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4 +title: Google Sheets Document operations +description: Documentation for the Document operations in Google Sheets node in n8n, a workflow automation platform. Includes details of operations and configuration, and links to examples and credentials information. +contentType: integration +priority: critical +--- + +# Google Sheets Document operations + +Use this operation to create or delete a Google spreadsheet from Google Sheets. Refer to [Google Sheets](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/) for more information on the Google Sheets node itself. + +## Create a spreadsheet + +Use this operation to create a new spreadsheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Document**. +- **Operation**: Select **Create**. +- **Title**: Enter the title of the new spreadsheet you want to create. +- **Sheets**: Add the **Title(s)** of the sheet(s) you want to create within the spreadsheet. + + +### Options + +- **Locale**: Enter the locale of the spreadsheet. This affects formatting details such as functions, dates, and currency. Use one of the following formats: + - `en` (639-1) + - `fil` (639-2 if no 639-1 format exists) + - `en_US` (combination of ISO language and country). + - Refer to [List of ISO 639 language codes](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes){:target=_blank .external link} and [List of ISO 3166 country codes](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes){:target=_blank .external link} for language and country codes. Note that Google doesn't support all locales/languages. +- **Recalculation Interval**: Enter the desired recalculation interval for the spreadsheet functions. This affects how often `NOW`, `TODAY`, `RAND`, and `RANDBETWEEN` are updated. Select **On Change** for recalculating whenever there is a change in the spreadsheet, **Minute** for recalculating every minute, or **Hour** for recalculating every hour. Refer to [Set a spreadsheet’s location & calculation settings](https://support.google.com/docs/answer/58515){:target=_blank .external-link} for more information about these options. + +Refer to the [Method: spreadsheets.create | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/create){:target=_blank .external-link} API documentation for more information. + +## Delete a spreadsheet + +Use this operation to delete an existing spreadsheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Document**. +- **Operation**: Select **Delete**. +- **Document**: Choose a spreadsheet you want to delete. + - Select **From list** to choose the title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. + +Refer to the [Method: files.delete | Google Drive](https://developers.google.com/drive/api/reference/rest/v2/files/delete){:target=_blank .external-link} API documentation for more information. \ No newline at end of file diff --git a/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/index.md b/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/index.md new file mode 100644 index 000000000..5e229c7c6 --- /dev/null +++ b/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/index.md @@ -0,0 +1,81 @@ +--- +#https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4 +title: Google Sheets +description: Documentation for the Google Sheets node in n8n, a workflow automation platform. Includes details of operations and configuration, and links to examples and credentials information. +contentType: integration +priority: critical +--- + +# Google Sheets + +Use the Google Sheets node to automate work in Google Sheets, and integrate Google Sheets with other applications. n8n has built-in support for a wide range of Google Sheets features, including creating, updating, deleting, appending, removing and getting documents. + +On this page, you'll find a list of operations the Google Sheets node supports and links to more resources. + +/// note | Credentials +Refer to [Google Sheets credentials](/integrations/builtin/credentials/google/) for guidance on setting up authentication. +/// + +## Operations + +* **Document** + * [**Create**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/document-operations/#create-a-spreadsheet) a spreadsheet. + * [**Delete**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/document-operations/#delete-a-spreadsheet) a spreadsheet. +* **Sheet Within Document** + * [**Append or Update Row**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations/#append-or-update-row): Append a new row, or update the current one if it already exists. + * [**Append Row**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations/#append-row): Create a new row. + * [**Clear**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations/#clear-a-sheet) all data from a sheet. + * [**Create**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations/#create-a-new-sheet) a new sheet. + * [**Delete**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations/#delete-a-sheet) a sheet. + * [**Delete Rows or Columns**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations/#delete-rows-or-columns): Delete columns and rows from a sheet. + * [**Get Row(s)**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations/#get-rows): Read all rows in a sheet. + * [**Update Row**](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations/#update-row): Update a row in a sheet. + + +## Templates and examples + + +[[ templatesWidget(title, 'google-sheets') ]] + +## Related resources + +Refer to [Google Sheet's API documentation](https://developers.google.com/sheets/api){:target=_blank .external-link} for more information about the service. + +--8<-- "_snippets/integrations/builtin/app-nodes/operation-not-supported.md" + + + +## Append an array + +To insert an array of data into Google Sheets, you must convert the array into a valid JSON (key, value) format. + +To do so, consider using: + +1. The [Split Out](/integrations/builtin/core-nodes/n8n-nodes-base.splitout/) node. +1. The [AI Transform](/integrations/builtin/core-nodes/n8n-nodes-base.aitransform/) node. For example, try entering something like: + ``` + Convert 'languages' array to JSON (key, value) pairs. + ``` +1. The [Code node](/integrations/builtin/core-nodes/n8n-nodes-base.code/). + +## Column names were updated after the node's setup + +You'll receive this error if the Google Sheet's column names have changed since you set up the node. + +To refresh the column names, re-select **Mapping Column Mode**. This should prompt the node to fetch the column names again. + +Once the column names refresh, update the node parameters. diff --git a/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations.md b/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations.md new file mode 100644 index 000000000..0c6d34728 --- /dev/null +++ b/docs/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations.md @@ -0,0 +1,223 @@ +--- +#https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4 +title: Google Sheets Sheet Within Document operations +description: Documentation for the Sheet operations in Google Sheets node in n8n, a workflow automation platform. Includes details of operations and configuration, and links to examples and credentials information. +contentType: integration +priority: critical +--- + +# Google Sheets Sheet Within Document operations + +Use this operation to create, update, clear or delete a sheet in a Google spreadsheet from Google Sheets. Refer to [Google Sheets](/integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/) for more information on the Google Sheets node itself. + +## Append or Update Row + +Use this operation to update an existing row or add a new row at the end of the data if a matching entry isn't found in a sheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Sheet Within Document**. +- **Operation**: Select **Append or Update Row**. +- **Document**: Choose a spreadsheet that contains the sheet you want to append or update row(s) to. + - Select **From list** to choose the spreadsheet title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. +- **Sheet**: Choose a sheet you want to append or update row(s) to. + - Select **From list** to choose the sheet title from the dropdown list, **By URL** to enter the url of the sheet, **By ID** to enter the `sheetId`, or **By Name** to enter the sheet title. + - You can find the `sheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId`. +- **Mapping Column Mode**: + - **Map Each Column Manually**: Enter **Values to Send** for each column. + - **Map Automatically**: n8n looks for incoming data that matches the columns in Google Sheets automatically. In this mode, make sure the incoming data fields are the same as the columns in Google Sheets. (Use an [Edit Fields](/integrations/builtin/core-nodes/n8n-nodes-base.set/) node before this node to change them if required.) + - **Nothing**: Don't map any data. + +### Options +--8<-- "_snippets/integrations/builtin/app-nodes/googlesheets/node-options.md" + +Refer to the [Method: spreadsheets.values.update | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update){:target=_blank .external-link} API documentation for more information. + +## Append Row + +Use this operation to append a new row at the end of the data in a sheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Sheet Within Document**. +- **Operation**: Select **Append Row**. +- **Document**: Choose a spreadsheet with the sheet you want to append a row to. + - Select **From list** to choose the spreadsheet title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. +- **Sheet**: Choose a sheet you want to append a row to. + - Select **From list** to choose the sheet title from the dropdown list, **By URL** to enter the url of the sheet, **By ID** to enter the `sheetId`, or **By Name** to enter the sheet title. + - You can find the `sheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId`. +- **Mapping Column Mode**: + - **Map Each Column Manually**: Select the **Column to Match On** when finding the rows to update. Enter **Values to Send** for each column. + - **Map Automatically**: n8n looks for incoming data that matches the columns in Google Sheets automatically. In this mode, make sure the incoming data fields are the same as the columns in Google Sheets. (Use an [Edit Fields](/integrations/builtin/core-nodes/n8n-nodes-base.set/) node before this node to change them if required.) + - **Nothing**: Don't map any data. + +### Options +--8<-- "_snippets/integrations/builtin/app-nodes/googlesheets/node-options.md" + +Refer to the [Method: spreadsheets.values.append | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append){:target=_blank .external-link} API documentation for more information. + +## Clear a sheet + +Use this operation to clear all data from a sheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Sheet Within Document**. +- **Operation**: Select **Clear**. +- **Document**: Choose a spreadsheet with the sheet you want to clear data from. + - Select **From list** to choose the spreadsheet title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. +- **Sheet**: Choose a sheet you want to clear data from. + - Select **From list** to choose the sheet title from the dropdown list, **By URL** to enter the url of the sheet, **By ID** to enter the `sheetId`, or **By Name** to enter the sheet title. + - You can find the `sheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId`. +- **Clear**: Select what data you want cleared from the sheet. + - **Whole Sheet**: Clear the entire sheet's data. Turn on **Keep First Row** to keep the first row of the sheet. + - **Specific Rows**: Clear data from specific rows. Also enter: + - **Start Row Number**: Enter the first row number you want to clear. + - **Number of Rows to Delete**: Enter the number of rows to clear. `1` clears data only the row in the **Start Row Number**. + - **Specific Columns**: Clear data from specific columns. Also enter: + - **Start Column**: Enter the first column you want to clear using the letter notation. + - **Number of Columns to Delete**: Enter the number of columns to clear. `1` clears data only in the **Start Column**. + - **Specific Range**: Enter the table range to clear data from, in [A1 notation](https://developers.google.com/sheets/api/guides/concepts#cell){:target=_blank .external-link}. + +Refer to the [Method: spreadsheets.values.clear | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear){:target=_blank .external-link} API documentation for more information. + +## Create a new sheet + +Use this operation to create a new sheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Sheet Within Document**. +- **Operation**: Select **Create**. +- **Document**: Choose a spreadsheet in which you want to create a new sheet. + - Select **From list** to choose the spreadsheet title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. +- **Title**: Enter the title for your new sheet. + +### Options + +- **Hidden**: Turn on this option to keep the sheet hidden in the UI. +- **Right To Left**: Turn on this option to use RTL sheet instead of an LTR sheet. +- **Sheet ID**: Enter the ID of the sheet. + - You can find the `sheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId` +- **Sheet Index**: By default, the new sheet is the last sheet in the spreadsheet. To override this behavior, enter the index you want the new sheet to use. When you add a sheet at a given index, Google increments the indices for all following sheets. Refer to [Sheets | SheetProperties](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#SheetProperties){:target=_blank .external-link} documentation for more information. +- **Tab Color**: Enter the color as hex code or use the color picker to set the color of the tab in the UI. + +Refer to the [Method: spreadsheets.batchUpdate | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate){:target=_blank .external-link} API documentation for more information. + +## Delete a sheet + +Use this operation to permanently delete a sheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Sheet Within Document**. +- **Operation**: Select **Delete**. +- **Document**: Choose a spreadsheet that contains the sheet you want to delete. + - Select **From list** to choose the spreadsheet title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. +- **Sheet**: Choose the sheet you want to delete. + - Select **From list** to choose the sheet title from the dropdown list, **By URL** to enter the url of the sheet, **By ID** to enter the `sheetId`, or **By Name** to enter the name of the sheet. + - You can find the `sheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId`. + +Refer to the [Method: spreadsheets.batchUpdate | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate){:target=_blank .external-link} API documentation for more information. + +## Delete Rows or Columns + +Use this operation to delete rows or columns in a sheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Sheet Within Document**. +- **Operation**: Select **Delete Rows or Columns**. +- **Document**: Choose a spreadsheet that contains the sheet you want to delete rows or columns from. + - Select **From list** to choose the spreadsheet title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. +- **Sheet**: Choose the sheet in which you want to delete rows or columns. + - Select **From list** to choose the sheet title from the dropdown list, **By URL** to enter the url of the sheet, **By ID** to enter the `sheetId`, or **By Name** to enter the name of the sheet. + - You can find the `sheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId`. +- **Start Row Number** or **Start Column**: Enter the row number or column letter to start deleting. +- **Number of Rows to Delete** or **Number of Columns to delete**: Enter the number of rows or columns to delete. + +Refer to the [Method: spreadsheets.batchUpdate | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate){:target=_blank .external-link} API documentation for more information. + +## Get Row(s) + +Use this operation to read one or more rows from a sheet. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Sheet Within Document**. +- **Operation**: Select **Get Row(s)**. +- **Document**: Choose a spreadsheet that contains the sheet you want to get rows from. + - Select **From list** to choose the spreadsheet title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. +- **Sheet**: Choose a sheet you want to read rows from. + - Select **From list** to choose the sheet title from the dropdown list, **By URL** to enter the url of the sheet, **By ID** to enter the `sheetId`, or **By Name** to enter the name of the sheet. + - You can find the `sheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId`. +- **Filters**: By default, the node returns all rows in the sheet. Set filters to return a limited set of results: + - **Column**: Select the column in your sheet to search against. + - **Value**: Enter a cell value to search for. You can drag input data parameters here. + If your filter matches multiple rows, n8n returns the first result. If you want all matching rows: + 1. Under **Options**, select **Add Option** > **When Filter Has Multiple Matches**. + 2. Change **When Filter Has Multiple Matches** to **Return All Matches**. + +### Options + +- **Data Location on Sheet**: Use this option to specify a data range. By default, n8n will detect the range automatically until the last row in the sheet. +- **Output Formatting**: Use this option to choose how n8n formats the data returned by Google Sheets. + - **General Formatting**: + - **Values (unformatted)** (default): n8n removes currency signs and other special formatting. Data type remains as number. + - **Values (formatted)**: n8n displays the values as they appear in Google Sheets (for example, retaining commas or currency signs) by converting the data type from number to string. + - **Formulas**: n8n returns the formula. It doesn't calculate the formula output. For example, if a cell B2 has the formula `=A2`, n8n returns B2's value as `=A2` (in text). Refer to [About date & time values | Google Sheets](https://developers.google.com/sheets/api/guides/formats#about_date_time_values){:target=_blank .external-link} for more information. + - **Date Formatting**: Refer to [DateTimeRenderOption | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption){:target=_blank .external-link} for more information. + - **Formatted Text** (default): As displayed in Google Sheets, which depends on the spreadsheet locale. For example `01/01/2024`. + - **Serial Number**: Number of days since December 30th 1899. +- **When Filter Has Multiple Matches**: Set to **Return All Matches** to get multiple matches. By default only the first result gets returned. + +/// note | First row +n8n treats the first row in a Google Sheet as a heading row, and doesn't return it when reading all rows. If you want to read the first row, use the **Options** to set **Data Location on Sheet**. +/// + +Refer to the [Method: spreadsheets.batchUpdate | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate){:target=_blank .external-link} API documentation for more information. + +## Update Row + +Use this operation to update existing row in a sheet. This operation only updates existing rows. To append rows when a matching entry isn't found in a sheet, use **Append or Update Row** operation instead. + +Enter these parameters: + +- **Credential to connect with**: Create or select an existing [Google Sheets credentials](/integrations/builtin/credentials/google/). +- **Resource**: Select **Sheet Within Document**. +- **Operation**: Select **Update Row**. +- **Document**: Choose a spreadsheet with the sheet you want to update. + - Select **From list** to choose the spreadsheet title from the dropdown list, **By URL** to enter the url of the spreadsheet, or **By ID** to enter the `spreadsheetId`. + - You can find the `spreadsheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0`. +- **Sheet**: Choose a sheet you want to update. + - Select **From list** to choose the sheet title from the dropdown list, **By URL** to enter the url of the sheet, **By ID** to enter the `sheetId`, or **By Name** to enter the sheet title. + - You can find the `sheetId` in a Google Sheets URL: `https://docs.google.com/spreadsheets/d/aBC-123_xYz/edit#gid=sheetId`. +- **Mapping Column Mode**: + - **Map Each Column Manually**: Enter **Values to Send** for each column. + - **Map Automatically**: n8n looks for incoming data that matches the columns in Google Sheets automatically. In this mode, make sure the incoming data fields are the same as the columns in Google Sheets. (Use an [Edit Fields](/integrations/builtin/core-nodes/n8n-nodes-base.set/) node before this node to change them if required.) + - **Nothing**: Don't map any data. + +### Options + +- **Cell Format**: Use this option to choose how to format the data in cells. Refer to [Google Sheets API | CellFormat](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/cells#CellFormat){:target=_blank .external-link} for more information. + - **Let Google Sheets format** (default): n8n formats text and numbers in the cells according to Google Sheets' default settings. + - **Let n8n format**: New cells in your sheet will have the same data types as the input data provided by n8n. +- **Data Location on Sheet**: Use this option when you need to specify where the data range on your sheet. + - **Header Row**: Specify the row index that contains the column headers. + - **First Data Row**: Specify the row index where the actual data starts. + +Refer to the [Method: spreadsheets.batchUpdate | Google Sheets](https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate){:target=_blank .external-link} API documentation for more information. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 3d1eb0b84..af6ba96d0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -498,7 +498,10 @@ nav: - Google Docs: integrations/builtin/app-nodes/n8n-nodes-base.googledocs.md - Google Drive: integrations/builtin/app-nodes/n8n-nodes-base.googledrive.md - Google Perspective: integrations/builtin/app-nodes/n8n-nodes-base.googleperspective.md - - Google Sheets: integrations/builtin/app-nodes/n8n-nodes-base.googlesheets.md + - Google Sheets: + - Google Sheets: integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/index.md + - Document Operations: integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/document-operations.md + - Sheet within Document Operations: integrations/builtin/app-nodes/n8n-nodes-base.googlesheets/sheet-operations.md - Google Slides: integrations/builtin/app-nodes/n8n-nodes-base.googleslides.md - Google Tasks: integrations/builtin/app-nodes/n8n-nodes-base.googletasks.md - Google Translate: integrations/builtin/app-nodes/n8n-nodes-base.googletranslate.md diff --git a/styles/config/vocabularies/default/accept.txt b/styles/config/vocabularies/default/accept.txt index 694d68346..57c85696a 100644 --- a/styles/config/vocabularies/default/accept.txt +++ b/styles/config/vocabularies/default/accept.txt @@ -220,12 +220,14 @@ Sendy Serp Serverless serverless +sheetId Shopify shopify signup Splunk Spontit Spotify +spreadsheetId Stackby Stackshare Storyblok