From f68ccd75fdf9f66ff9e3e07840145ba952d3f851 Mon Sep 17 00:00:00 2001 From: Vikhyath Mondreti Date: Wed, 12 Nov 2025 22:10:33 -0800 Subject: [PATCH] fix --- apps/sim/blocks/blocks/google_sheets.ts | 15 ++++++++++++++- apps/sim/blocks/blocks/microsoft_excel.ts | 16 ++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/apps/sim/blocks/blocks/google_sheets.ts b/apps/sim/blocks/blocks/google_sheets.ts index 4af33ed2c7..d2e79ba5d3 100644 --- a/apps/sim/blocks/blocks/google_sheets.ts +++ b/apps/sim/blocks/blocks/google_sheets.ts @@ -172,7 +172,20 @@ export const GoogleSheetsBlock: BlockConfig = { params: (params) => { const { credential, values, spreadsheetId, manualSpreadsheetId, ...rest } = params - const parsedValues = values ? JSON.parse(values as string) : undefined + // Handle values - could be string (from UI) or already parsed (from variable reference) + let parsedValues + if (values) { + if (typeof values === 'string') { + try { + parsedValues = JSON.parse(values) + } catch (error) { + throw new Error('Invalid JSON format for values') + } + } else { + // Already an object/array from variable reference + parsedValues = values + } + } const effectiveSpreadsheetId = (spreadsheetId || manualSpreadsheetId || '').trim() diff --git a/apps/sim/blocks/blocks/microsoft_excel.ts b/apps/sim/blocks/blocks/microsoft_excel.ts index f6b9d58ec4..8d3625f1e8 100644 --- a/apps/sim/blocks/blocks/microsoft_excel.ts +++ b/apps/sim/blocks/blocks/microsoft_excel.ts @@ -149,11 +149,19 @@ export const MicrosoftExcelBlock: BlockConfig = { const effectiveSpreadsheetId = (spreadsheetId || manualSpreadsheetId || '').trim() + // Handle values - could be string (from UI) or already parsed (from variable reference) let parsedValues - try { - parsedValues = values ? JSON.parse(values as string) : undefined - } catch (error) { - throw new Error('Invalid JSON format for values') + if (values) { + if (typeof values === 'string') { + try { + parsedValues = JSON.parse(values) + } catch (error) { + throw new Error('Invalid JSON format for values') + } + } else { + // Already an object/array from variable reference + parsedValues = values + } } if (!effectiveSpreadsheetId) {