Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(google-sheets): keep hidden rows, columns and worksheets hidden when an agent resizes or restyles them (#16734)

Kishan Parmara491e7ffb225
diff --git a/bun.lock b/bun.lock
index 2ce6c5bf7ff..89282463840 100644
--- a/bun.lock
+++ b/bun.lock
@@ -4048,7 +4048,7 @@
},
"packages/pieces/community/google-sheets": {
"name": "@activepieces/piece-google-sheets",
- "version": "0.18.2",
+ "version": "0.19.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/google-sheets/package.json b/packages/pieces/community/google-sheets/package.json
index 95a32fb0234..3d8d526b86d 100644
--- a/packages/pieces/community/google-sheets/package.json
+++ b/packages/pieces/community/google-sheets/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-google-sheets",
- "version": "0.18.2",
+ "version": "0.19.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
diff --git a/packages/pieces/community/google-sheets/src/i18n/translation.json b/packages/pieces/community/google-sheets/src/i18n/translation.json
index e6858db782a..8d3735bdbdf 100644
--- a/packages/pieces/community/google-sheets/src/i18n/translation.json
+++ b/packages/pieces/community/google-sheets/src/i18n/translation.json
@@ -324,14 +324,14 @@
"The first column/row to update, 0-based and inclusive. Column A / row 1 is index 0. The range is half-open: [start, end).": "The first column/row to update, 0-based and inclusive. Column A / row 1 is index 0. The range is half-open: [start, end).",
"The index just past the last column/row to update (exclusive). To update only column A use start 0, end 1.": "The index just past the last column/row to update (exclusive). To update only column A use start 0, end 1.",
"The fixed width (for columns) or height (for rows) in pixels. Leave empty to only change the hidden state.": "The fixed width (for columns) or height (for rows) in pixels. Leave empty to only change the hidden state.",
- "Whether the rows/columns are hidden. Leave empty to only change the pixel size.": "Whether the rows/columns are hidden. Leave empty to only change the pixel size.",
+ "Whether the rows/columns are hidden. Leave empty or pick Leave unchanged to keep the current setting.": "Whether the rows/columns are hidden. Leave empty or pick Leave unchanged to keep the current setting.",
"An array of row objects, each with a numeric \"rowId\" plus cells keyed by column letter, e.g. [{\"rowId\":2,\"A\":\"x\",\"B\":\"y\"},{\"rowId\":5,\"A\":\"z\"}]. Rows without a rowId are skipped.": "An array of row objects, each with a numeric \"rowId\" plus cells keyed by column letter, e.g. [{\"rowId\":2,\"A\":\"x\",\"B\":\"y\"},{\"rowId\":5,\"A\":\"z\"}]. Rows without a rowId are skipped.",
"The row number to update.": "The row number to update.",
"The row values. If \"Values Keyed by Column Letter\" is on, pass an object like {\"A\":\"x\",\"B\":\"y\"}; otherwise pass an array like [\"x\",\"y\"]. Empty strings skip (do not clear) the cell.": "The row values. If \"Values Keyed by Column Letter\" is on, pass an object like {\"A\":\"x\",\"B\":\"y\"}; otherwise pass an array like [\"x\",\"y\"]. Empty strings skip (do not clear) the cell.",
"Number of rows to freeze at the top (e.g. 1 to freeze a header row). Set 0 to unfreeze.": "Number of rows to freeze at the top (e.g. 1 to freeze a header row). Set 0 to unfreeze.",
"Number of columns to freeze at the left. Set 0 to unfreeze.": "Number of columns to freeze at the left. Set 0 to unfreeze.",
"HEX color code for the tab, e.g. #FF0000.": "HEX color code for the tab, e.g. #FF0000.",
- "Whether the worksheet tab is hidden.": "Whether the worksheet tab is hidden.",
+ "Whether the worksheet tab is hidden. Leave empty or pick Leave unchanged to keep the current setting.": "Whether the worksheet tab is hidden. Leave empty or pick Leave unchanged to keep the current setting.",
"The exact tab title to write to. Must match the tab name exactly (including spacing/case). Resolve via sheets_get_spreadsheet or sheets_find_worksheet.": "The exact tab title to write to. Must match the tab name exactly (including spacing/case). Resolve via sheets_get_spreadsheet or sheets_find_worksheet.",
"The cell range to write to, e.g. A1:D10. The shape of the values array must match this range (a 1x1 range cannot accept a 2x2 array).": "The cell range to write to, e.g. A1:D10. The shape of the values array must match this range (a 1x1 range cannot accept a 2x2 array).",
"A 2D array of values, e.g. [[\"Name\",\"Age\"],[\"Alice\",30]]. Each inner array is one row (when major dimension is ROWS) or one column (when COLUMNS).": "A 2D array of values, e.g. [[\"Name\",\"Age\"],[\"Alice\",30]]. Each inner array is one row (when major dimension is ROWS) or one column (when COLUMNS).",
@@ -359,12 +359,28 @@
"Formatted Value": "Formatted Value",
"Unformatted Value": "Unformatted Value",
"Formula": "Formula",
+ "Yes": "Yes",
+ "No": "No",
+ "Leave unchanged": "Leave unchanged",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
"PUT": "PUT",
"DELETE": "DELETE",
"HEAD": "HEAD",
+ "New Row": "New Row",
+ "New Rows": "New Rows",
+ "Options": "Options",
+ "Row": "Row",
+ "Changes": "Changes",
+ "Search": "Search",
+ "Style": "Style",
+ "Memory": "Memory",
+ "Cells": "Cells",
+ "New Column": "New Column",
+ "Export": "Export",
+ "Request": "Request",
+ "Data to send": "Data to send",
"New or Updated Row": "New or Updated Row",
"New Row Added": "New Row Added",
"New Spreadsheet": "New Spreadsheet",
diff --git a/packages/pieces/community/google-sheets/src/lib/actions/sheets-update-dimension-properties.ts b/packages/pieces/community/google-sheets/src/lib/actions/sheets-update-dimension-properties.ts
index e8ce3736505..bd941370d9d 100644
--- a/packages/pieces/community/google-sheets/src/lib/actions/sheets-update-dimension-properties.ts
+++ b/packages/pieces/community/google-sheets/src/lib/actions/sheets-update-dimension-properties.ts
@@ -3,6 +3,7 @@ import { sheets as googleSheets } from '@googleapis/sheets';
import { isNil } from '@activepieces/pieces-framework';
import { areSheetIdsValid, createGoogleClient, Dimension, googleSheetsAuth } from '../common/common';
import { sheetsUpdateDimensionPropertiesActionOutputSchema } from '../output-schemas';
+import { hiddenStateProp, hiddenStateValue } from '../common/props';
export const sheetsUpdateDimensionProperties = createAction({
auth: googleSheetsAuth,
@@ -60,15 +61,12 @@ export const sheetsUpdateDimensionProperties = createAction({
description: 'The fixed width (for columns) or height (for rows) in pixels. Leave empty to only change the hidden state.',
required: false,
}),
- hidden: Property.Checkbox({
- displayName: 'Hidden',
- description: 'Whether the rows/columns are hidden. Leave empty to only change the pixel size.',
- required: false,
- }),
+ hidden: hiddenStateProp('Whether the rows/columns are hidden.'),
},
async run(context) {
- const { spreadsheet_id, sheet_id, dimension, start_index, end_index, pixel_size, hidden } =
+ const { spreadsheet_id, sheet_id, dimension, start_index, end_index, pixel_size } =
context.propsValue;
+ const hidden = hiddenStateValue(context.propsValue.hidden);
if (!areSheetIdsValid(spreadsheet_id, sheet_id)) {
throw new Error('Please provide a spreadsheet id and worksheet id.');
diff --git a/packages/pieces/community/google-sheets/src/lib/actions/sheets-update-sheet-properties.ts b/packages/pieces/community/google-sheets/src/lib/actions/sheets-update-sheet-properties.ts
index e3219be7399..0a1fbc357c2 100644
--- a/packages/pieces/community/google-sheets/src/lib/actions/sheets-update-sheet-properties.ts
+++ b/packages/pieces/community/google-sheets/src/lib/actions/sheets-update-sheet-properties.ts
@@ -3,6 +3,7 @@ import { sheets as googleSheets } from '@googleapis/sheets';
import { isNil } from '@activepieces/pieces-framework';
import { areSheetIdsValid, createGoogleClient, googleSheetsAuth } from '../common/common';
import { sheetsUpdateSheetPropertiesActionOutputSchema } from '../output-schemas';
+import { hiddenStateProp, hiddenStateValue } from '../common/props';
export const sheetsUpdateSheetProperties = createAction({
auth: googleSheetsAuth,
@@ -45,15 +46,12 @@ export const sheetsUpdateSheetProperties = createAction({
description: 'HEX color code for the tab, e.g. #FF0000.',
required: false,
}),
- hidden: Property.Checkbox({
- displayName: 'Hidden',
- description: 'Whether the worksheet tab is hidden.',
- required: false,
- }),
+ hidden: hiddenStateProp('Whether the worksheet tab is hidden.'),
},
async run(context) {
- const { spreadsheet_id, sheet_id, frozen_row_count, frozen_column_count, tab_color, hidden } =
+ const { spreadsheet_id, sheet_id, frozen_row_count, frozen_column_count, tab_color } =
context.propsValue;
+ const hidden = hiddenStateValue(context.propsValue.hidden);
if (!areSheetIdsValid(spreadsheet_id, sheet_id)) {
throw new Error('Please provide a spreadsheet id and worksheet id.');
diff --git a/packages/pieces/community/google-sheets/src/lib/common/props.ts b/packages/pieces/community/google-sheets/src/lib/common/props.ts
index c56a1054a60..7717f72184b 100644
--- a/packages/pieces/community/google-sheets/src/lib/common/props.ts
+++ b/packages/pieces/community/google-sheets/src/lib/common/props.ts
@@ -275,3 +275,25 @@ export const isFirstRowHeaderProp = () =>
required: false,
defaultValue: false,
});
+
+export const hiddenStateProp = (description: string) =>
+ Property.StaticDropdown<string, false>({
+ displayName: 'Hidden',
+ description: `${description} Leave empty or pick Leave unchanged to keep the current setting.`,
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Yes', value: 'yes' },
+ { label: 'No', value: 'no' },
+ { label: 'Leave unchanged', value: 'unchanged' },
+ ],
+ },
+ });
+
+export const hiddenStateValue = (value: unknown): boolean | undefined => {
+ const normalized = typeof value === 'string' ? value.trim().toLowerCase() : value;
+ if (normalized === true || normalized === 'yes' || normalized === 'true') return true;
+ if (normalized === false || normalized === 'no' || normalized === 'false') return false;
+ return undefined;
+};