minor changes

This commit is contained in:
2026-07-28 14:56:45 +02:00
parent 3abd381f2e
commit 7e2a84681a
+2 -20
View File
@@ -166,7 +166,8 @@ async function splitExcelFile(inputFile) {
const worksheet = workbook.getWorksheet(1); const worksheet = workbook.getWorksheet(1);
const headerRow = worksheet.getRow(1).actualCellCount; //number of columns of the table const headerRow = worksheet.getRow(1).actualCellCount; //number of columns of the table
numRows = (worksheet.actualRowCount) - 1; numRows = (worksheet.actualRowCount) - 1; // since it counts the row that represents the header, I need to subtract -1
// to get the actual number of rows that contains the data
worksheet.getRow(1) // to convert every title of the first row to upper case worksheet.getRow(1) // to convert every title of the first row to upper case
.eachCell((col, col_num) => { .eachCell((col, col_num) => {
@@ -175,25 +176,6 @@ async function splitExcelFile(inputFile) {
} }
}) })
// convert every letter of CF to uppercase and store the CFs in the array cf
if (worksheet.getRow(1).getCell(6).value.trim() === 'CODICE FISCALE') {
worksheet.getColumn(6)
.eachCell((row, row_num) => {
row.value = (row.value).toString().toUpperCase();
})
}
worksheet.getColumn(8) // of the first file
.eachCell((cell, rownumber) => {
if (typeof cell.value === 'string') {
cell.value = (cell.value).replace(/\b\w/g, char => char.toUpperCase());
/* \b finds the start of a word (the boundary of a word)
\w targets the first letter following that boundary
/g (global flag) ensures it updates every word
*/
}
})
// to store the names of the columns in columnNames // to store the names of the columns in columnNames
worksheet.getRow(1).eachCell({ includeEmpty: true }, (cell, cell_num) => { worksheet.getRow(1).eachCell({ includeEmpty: true }, (cell, cell_num) => {
columnNames.push(cell.value); columnNames.push(cell.value);