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) {