temp: save local progress before merge
This commit is contained in:
27
scratch/parse_svr_excel.js
Normal file
27
scratch/parse_svr_excel.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import pkg from 'xlsx';
|
||||
const { readFile, utils } = pkg;
|
||||
|
||||
try {
|
||||
const workbook = readFile('c:/Project/HM ITAM/SampleData_SVR.xlsx');
|
||||
|
||||
for (const sheetName of workbook.SheetNames) {
|
||||
console.log(`\n================= Sheet: ${sheetName} =================`);
|
||||
const sheet = workbook.Sheets[sheetName];
|
||||
const rawRows = utils.sheet_to_json(sheet, { header: 1 });
|
||||
const validRows = rawRows.filter(row => {
|
||||
return row.some(val => val !== undefined && val !== null && String(val).trim() !== '');
|
||||
});
|
||||
|
||||
const header = validRows[0];
|
||||
const assetNameIdx = header.indexOf('자산명');
|
||||
const typeIdx = header.indexOf('유형');
|
||||
const detailIdx = header.indexOf('상세');
|
||||
const teamIdx = header.indexOf('팀명');
|
||||
|
||||
validRows.slice(1).forEach((row, idx) => {
|
||||
console.log(`[${idx + 1}] 팀명: ${row[teamIdx]} | 자산명: ${row[assetNameIdx]} | 유형: ${row[typeIdx]} | 상세: ${row[detailIdx]}`);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
Reference in New Issue
Block a user