omg this is working

This commit is contained in:
Ben Miller
2024-11-13 23:43:32 -07:00
parent fb86c9c96d
commit a5c0a1176d
22 changed files with 2152 additions and 53 deletions

View File

@ -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
}