Browse Source

Fix file excel

master
Hou Samnang 1 month ago
parent
commit
322b18487b
  1. BIN
      data/data.xlsx
  2. 2
      src/index.js

BIN
data/data.xlsx

Binary file not shown.

2
src/index.js

@ -40,7 +40,7 @@ app.post('/upload', async function (req, res) {
let input = req.body.myFile;
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 }))
res.send(data)

Loading…
Cancel
Save