make newSku resiliant to column moves
This commit is contained in:
@ -24,12 +24,20 @@ export function getCellValueByColumnName(
|
||||
export function getColumnRangeByName(
|
||||
sheet: GoogleAppsScript.Spreadsheet.Sheet,
|
||||
columnName: string
|
||||
) {
|
||||
let column = getColumnByName(sheet, columnName)
|
||||
if (column != -1) {
|
||||
return sheet.getRange(2, column, sheet.getMaxRows())
|
||||
}
|
||||
}
|
||||
|
||||
export function getColumnByName(
|
||||
sheet: GoogleAppsScript.Spreadsheet.Sheet,
|
||||
columnName: string
|
||||
) {
|
||||
let data = sheet.getRange("A1:1").getValues()
|
||||
let column = data[0].indexOf(columnName)
|
||||
if (column != -1) {
|
||||
return sheet.getRange(2, column + 1, sheet.getMaxRows())
|
||||
}
|
||||
return column + 1
|
||||
}
|
||||
|
||||
export function getColumnValuesByName(
|
||||
|
||||
Reference in New Issue
Block a user