Compare commits
No commits in common. "a70f7aed34291690b272edef37e5d75e6e9f3bf0" and "eca233352174adeb678385691a9d4817148d0c9a" have entirely different histories.
a70f7aed34
...
eca2333521
Binary file not shown.
@ -4,8 +4,7 @@
|
|||||||
"description": "Nodejs data migration with excel, csv and rest apis.",
|
"description": "Nodejs data migration with excel, csv and rest apis.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest",
|
"test": "jest"
|
||||||
"start": "node src/index.js"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -25,7 +24,6 @@
|
|||||||
},
|
},
|
||||||
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
src/index.js
26
src/index.js
@ -1,20 +1,16 @@
|
|||||||
// const file = require('fs')
|
const file = require('fs')
|
||||||
|
|
||||||
// file.readFile('./data/people.csv', 'utf-8', (err, data) => {
|
file.readFile('./data/people.csv', 'utf-8', (err, data) => {
|
||||||
// if (err) {
|
if (err) {
|
||||||
// console.error(err)
|
console.error(err)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
|
|
||||||
// console.log(data)
|
console.log(data)
|
||||||
|
|
||||||
// const rows = data.split(/\r?\n/);
|
const rows = data.split(/\r?\n/);
|
||||||
// const header = rows[0].split(',').map(str => str.trim())
|
const header = rows[0].split(',').map(str => str.trim())
|
||||||
// console.log(header)
|
console.log(header)
|
||||||
|
|
||||||
// });
|
});
|
||||||
|
|
||||||
var XLSX = require('xlsx')
|
|
||||||
var workbook = XLSX.readFile('./data/Sanagro Product and Catagory list.xlsx');
|
|
||||||
var xlData = XLSX.utils.sheet_to_json(workbook.Sheets['Sheet2']);
|
|
||||||
console.log(xlData);
|
|
Loading…
Reference in New Issue
Block a user