enable changes based on template, refactor newSku
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user