Handle deletes

This commit is contained in:
adrinr 2023-02-27 13:33:19 +01:00
parent b231311a87
commit 30fde61d4d
1 changed files with 9 additions and 2 deletions

View File

@ -308,10 +308,17 @@ class GoogleSheetsIntegration implements DatasourcePlus {
}
await sheet.setHeaderRow(headers)
} else {
let newField = Object.keys(table.schema).find(
const updatedHeaderValues = [...sheet.headerValues]
const newField = Object.keys(table.schema).find(
key => !sheet.headerValues.includes(key)
)
await sheet.setHeaderRow([...sheet.headerValues, newField])
if (newField) {
updatedHeaderValues.push(newField)
}
await sheet.setHeaderRow(updatedHeaderValues)
}
} catch (err) {
console.error("Error updating table in google sheets", err)