omg this is working
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
function getCellRangeByColumnName(
|
||||
export function getCellRangeByColumnName(
|
||||
sheet: GoogleAppsScript.Spreadsheet.Sheet,
|
||||
columnName: string,
|
||||
row: number
|
||||
@ -10,7 +10,7 @@ function getCellRangeByColumnName(
|
||||
}
|
||||
}
|
||||
|
||||
function getCellValueByColumnName(
|
||||
export function getCellValueByColumnName(
|
||||
sheet: GoogleAppsScript.Spreadsheet.Sheet,
|
||||
columnName: string,
|
||||
row: number
|
||||
@ -21,7 +21,7 @@ function getCellValueByColumnName(
|
||||
}
|
||||
}
|
||||
|
||||
function getColumnRangeByName(
|
||||
export function getColumnRangeByName(
|
||||
sheet: GoogleAppsScript.Spreadsheet.Sheet,
|
||||
columnName: string
|
||||
) {
|
||||
@ -32,7 +32,7 @@ function getColumnRangeByName(
|
||||
}
|
||||
}
|
||||
|
||||
function getColumnValuesByName(
|
||||
export function getColumnValuesByName(
|
||||
sheet: GoogleAppsScript.Spreadsheet.Sheet,
|
||||
columnName: string
|
||||
) {
|
||||
@ -42,7 +42,7 @@ function getColumnValuesByName(
|
||||
}
|
||||
}
|
||||
|
||||
function vlookupByColumns(
|
||||
export function vlookupByColumns(
|
||||
sheetName: string,
|
||||
searchColumn: string,
|
||||
searchKey: string,
|
||||
@ -62,7 +62,26 @@ function vlookupByColumns(
|
||||
return resultValue
|
||||
}
|
||||
|
||||
function toastAndLog(message: string) {
|
||||
export function toastAndLog(message: string) {
|
||||
SpreadsheetApp.getActive().toast(message)
|
||||
console.log(message)
|
||||
}
|
||||
}
|
||||
|
||||
export function getRowByColumnValue(
|
||||
sheetName: string,
|
||||
columnName: string,
|
||||
searchKey: string
|
||||
) {
|
||||
let s = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName)
|
||||
let searchData = getColumnValuesByName(s, columnName)
|
||||
let dataList = searchData.map((x) => x[0])
|
||||
let index = dataList.indexOf(searchKey)
|
||||
|
||||
if (index === -1) {
|
||||
toastAndLog(searchKey + " not found")
|
||||
return
|
||||
}
|
||||
let resultRow = index + 2
|
||||
console.log("row found: " + resultRow)
|
||||
return resultRow
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user