enable changes based on template, refactor newSku

This commit is contained in:
Ben Miller
2024-11-04 21:48:31 -07:00
parent 20a5e738f7
commit 7316ba08d7
4 changed files with 29 additions and 10 deletions

View File

@ -14,6 +14,7 @@ function productTemplate(row: number) {
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("product_inventory")
let titleValue = getCellValueByColumnName(productInventorySheet, "title", row)
for (let i = 0; i < updateColumns.length; i++) {
let updateColumn = updateColumns[i]
let currentValue = getCellValueByColumnName(
productInventorySheet,
updateColumns[i],
@ -21,24 +22,30 @@ function productTemplate(row: number) {
)
if (currentValue != "") {
console.log(
"current value for '" + updateColumns[i] + "' is '" + currentValue + "'"
"current value for '" + updateColumn + "' is '" + currentValue + "'"
)
continue
}
let templateValue = vlookupByColumns(
var templateValue: string = ""
templateValue = vlookupByColumns(
"product_types",
"title",
titleValue,
updateColumns[i]
updateColumn
)
if (templateValue != "") {
console.log(
"template value for '" +
updateColumns[i] +
updateColumn +
"' is '" +
templateValue +
"'"
)
toastAndLog("updating '" + updateColumn + "' to '" + templateValue + "'")
let cell = getCellRangeByColumnName(productInventorySheet, updateColumn, row)
cell.setValue(templateValue)
}
}
console.log("updating sku...")
newSku(row)
}