Closed nnh53 closed 7 months ago
We choose this library for handling: https://www.npmjs.com/package/xlsx
I'm using these code to read the sample excel file, reference from the document above
import XLSX from "xlsx";
const xlsxPath = "../Employee-Sample-Data.xlsx";
const workbook = XLSX.readFile(xlsxPath);
const worksheet = workbook.Sheets["Data"];
const REGEX_ID = /^Ed\{5}$/gi;
const arrEmployee = XLSX.utils.sheet_to_json(worksheet);
console.log(`Total record: ${arrEmployee.length}`);
// console.log(arrEmployee);
// arrEmployee.forEach((employee) => {
// if (!employee.EEID.match(REGEX_ID)) {
// console.log(employee);
// }
// });
for (const employee of arrEmployee) {
console.log(employee);
}
My implement here:
im done, need turn to review @nnh53
send me a message to meeting with me @lcaohoanq, and demo for your BE mate @huy1707developer