This commit is contained in:
louiscklaw
2025-02-01 02:00:23 +08:00
parent b3da7aaef5
commit e46f1afc57
53 changed files with 7059 additions and 0 deletions

27
task1/utils/getLastRow.js Normal file
View File

@@ -0,0 +1,27 @@
function getLastRow(sheet) {
var output = { state: "init", debug: {sheet}, error: "" };
try {
var last_row = -1;
var row_scan = 99999;
for (let i = 1; i < row_scan; i++) {
if (checkLastRow(sheet, i)) {
// print last row number
last_row = i - 1;
output = { ...output, debug: { ...output.debug, last_row } };
console.log("last row is " + last_row.toString());
break;
} else {
// keep going
}
}
if (last_row == -1) {
throw new Error('cannot find the last row')
}
return last_row;
} catch (error) {
console.log('getLastRow error')
output = { ...output, error };
console.log(output);
}
}