Fix file excel
This commit is contained in:
parent
e5f439bffd
commit
322b18487b
BIN
data/data.xlsx
BIN
data/data.xlsx
Binary file not shown.
@ -40,7 +40,7 @@ app.post('/upload', async function (req, res) {
|
|||||||
let input = req.body.myFile;
|
let input = req.body.myFile;
|
||||||
let wb = XLSX.read(input, { type: 'binary' });
|
let wb = XLSX.read(input, { type: 'binary' });
|
||||||
|
|
||||||
let xlData = XLSX.utils.sheet_to_json(wb.Sheets['Sheet2']);
|
let xlData = XLSX.utils.sheet_to_json(wb.Sheets['Sheet1']);
|
||||||
let data = xlData.map((row) => ({ productName: row['Product name'], smallTypeName: row.SmallTypeName, productCategory: { productCategoryId: row['CategoryID'], newCategory: row['Category'] }, alert: row.alert, cost: row.cost, qtyStock: row.qtystock, sellPrice: row.sellPrice }))
|
let data = xlData.map((row) => ({ productName: row['Product name'], smallTypeName: row.SmallTypeName, productCategory: { productCategoryId: row['CategoryID'], newCategory: row['Category'] }, alert: row.alert, cost: row.cost, qtyStock: row.qtystock, sellPrice: row.sellPrice }))
|
||||||
res.send(data)
|
res.send(data)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user