Fix add file exect

This commit is contained in:
Hou Samnang 2021-03-26 17:37:36 +07:00
parent a70f7aed34
commit 74a5e57f15
3 changed files with 6 additions and 4 deletions

View File

@ -25,7 +25,8 @@
}, },
"homepage": "https://github.com/CUBETIQ/data-migration-nodejs#readme", "homepage": "https://github.com/CUBETIQ/data-migration-nodejs#readme",
"dependencies": { "dependencies": {
"xlsx": "^0.16.9", "jest": "^26.6.3",
"jest": "^26.6.3" "read-excel-file": "^5.0.0",
"xlsx": "^0.16.9"
} }
} }

View File

@ -16,5 +16,6 @@
var XLSX = require('xlsx') var XLSX = require('xlsx')
var workbook = XLSX.readFile('./data/Sanagro Product and Catagory list.xlsx'); var workbook = XLSX.readFile('./data/Sanagro Product and Catagory list.xlsx');
var xlData = XLSX.utils.sheet_to_json(workbook.Sheets['Sheet2']); var xlData = XLSX.utils.sheet_to_json(workbook.Sheets['Sheet1']);
console.log(xlData); var data = xlData.map((row) => ({ id: row.No, name: row['Product name'] }))
console.log(data);