node.js - How to get data row by row from a xlsx file in nodejs -


i facing issue need data xl file , convert record or row json format , send server issue here file gets changed frequently(mean new data added data appended new rows) every change need send added data server have come logic make note of last row have send server , when there change previous variable stores last row sent send rows variable last row .

so want know there way make refernce xlsx file rather loading whole file , getting row row data

mycode doesnt work way:

var fs = require('fs'); var xls= require('xlsx');  var book = xls.readfile('test.xlsx');  var sheet_name_list = book.sheetnames[0]; var sheet1 = book.sheets[sheet_name_list]; //console.log(sheet1);   var j = xls.utils.sheet_to_json(sheet1['a17']); console.log(j); 

what want observe file changes, node.js has [fs.watch][1] method this

observe file changes node.js

you need reread file every time change event.

also can try use excel-js package , reading xlsx via stream, i'm not sure send updates while adding rows


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -