simplify and update onEdit columns

This commit is contained in:
Ben Miller
2025-08-10 02:09:52 -06:00
parent 17e0c1b707
commit 62514fa20e

View File

@ -43,37 +43,24 @@ export function columnOnEditHandler(e: GoogleAppsScript.Events.SheetsOnEdit) {
for (let row = e.range.getRow(); row <= e.range.getLastRow(); row++) { for (let row = e.range.getRow(); row <= e.range.getLastRow(); row++) {
console.log("row: " + row) console.log("row: " + row)
let updateString = "updating " + header + " on row " + row let updateString = "updating " + header + " on row " + row
switch (header) { let shopifyUpdateColumns = [
case "shopify_status": "shopify_status",
toastAndLog(updateString) "title",
updateProductToShopify(row) "product_type",
break "tags",
case "title": "description",
toastAndLog(updateString) "base_price",
updateProductToShopify(row) "original_price",
break "weight_grams",
case "product_type": "product_height_cm",
toastAndLog(updateString) "product_width_cm",
updateProductToShopify(row) "product_depth_cm"
break ]
case "tags": if (shopifyUpdateColumns.includes(header)) {
toastAndLog(updateString) // Accumulate changes for 30s before updating
updateProductToShopify(row) toastAndLog(updateString)
break updateProductToShopify(row)
case "description": break
toastAndLog(updateString)
updateProductToShopify(row)
break
case "price":
toastAndLog(updateString)
updateProductToShopify(row)
break
case "compare_at_price":
toastAndLog(updateString)
updateProductToShopify(row)
break
default:
continue
} }
toastAndLog("completed " + updateString) toastAndLog("completed " + updateString)
} }