allow multiple rows for template
This commit is contained in:
@ -7,13 +7,14 @@ import {
|
||||
} from "./sheetUtils"
|
||||
|
||||
export function productTemplate(row: number) {
|
||||
//TODO: just use the columns that exist, if they match
|
||||
let updateColumns = [
|
||||
"function",
|
||||
"type",
|
||||
"category",
|
||||
"product_type",
|
||||
"tags",
|
||||
"price",
|
||||
"base_price",
|
||||
"shipping",
|
||||
"weight (grams)",
|
||||
]
|
||||
@ -21,6 +22,7 @@ export function productTemplate(row: number) {
|
||||
let productInventorySheet =
|
||||
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("product_inventory")
|
||||
let titleValue = getCellValueByColumnName(productInventorySheet, "title", row)
|
||||
//TODO: Make this *much* faster
|
||||
for (let i = 0; i < updateColumns.length; i++) {
|
||||
let updateColumn = updateColumns[i]
|
||||
let currentValue = getCellValueByColumnName(
|
||||
@ -43,14 +45,14 @@ export function productTemplate(row: number) {
|
||||
)
|
||||
if (templateValue != "") {
|
||||
console.log(
|
||||
"template value for '" +
|
||||
updateColumn +
|
||||
"' is '" +
|
||||
templateValue +
|
||||
"'"
|
||||
"template value for '" + updateColumn + "' is '" + templateValue + "'"
|
||||
)
|
||||
toastAndLog("updating '" + updateColumn + "' to '" + templateValue + "'")
|
||||
let cell = getCellRangeByColumnName(productInventorySheet, updateColumn, row)
|
||||
let cell = getCellRangeByColumnName(
|
||||
productInventorySheet,
|
||||
updateColumn,
|
||||
row
|
||||
)
|
||||
cell.setValue(templateValue)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user