mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
fix
This commit is contained in:
@@ -172,7 +172,20 @@ export const GoogleSheetsBlock: BlockConfig<GoogleSheetsResponse> = {
|
||||
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()
|
||||
|
||||
|
||||
@@ -149,11 +149,19 @@ export const MicrosoftExcelBlock: BlockConfig<MicrosoftExcelResponse> = {
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user