working version checkin
* add config class * add vlookup * add menu * add photo folder creation * add prep for product templates
This commit is contained in:
@ -41,3 +41,28 @@ function getColumnValuesByName(
|
||||
return column.getValues()
|
||||
}
|
||||
}
|
||||
|
||||
function vlookupByColumns(
|
||||
sheetName: string,
|
||||
searchColumn: string,
|
||||
searchKey: string,
|
||||
resultColumn: string
|
||||
) {
|
||||
let s = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName)
|
||||
let searchData = getColumnValuesByName(s, searchColumn)
|
||||
let dataList = searchData.map((x) => x[0])
|
||||
let index = dataList.indexOf(searchKey)
|
||||
|
||||
if (index === -1) {
|
||||
toastAndLog(searchKey + " not found")
|
||||
return
|
||||
}
|
||||
let resultValue = getCellValueByColumnName(s, resultColumn, index + 2)
|
||||
toastAndLog(resultValue)
|
||||
return resultValue
|
||||
}
|
||||
|
||||
function toastAndLog(message: string) {
|
||||
SpreadsheetApp.getActive().toast(message)
|
||||
console.log(message)
|
||||
}
|
||||
Reference in New Issue
Block a user