@ftlab/node-xls
v0.2.1
Published
node.js's module to extract data from Microsoft Excel™ File(.xls)
Downloads
5
Readme
node-xls
node.js's module to extract data from Microsoft Excel™ File(.xls)
Status
- supported file format : Excel 2 ~ 2003 File(.xls), not .xlsx file
- only cell data without a formula, format, hyperlink.
Supported Node.js Versions
- from v0.10 to v12 : supported
Changelog
Add a synchronous read function
Original item
Installation
npm i node-xls --save
Usage
var xl = require('../lib');
// node-xls using read
const wb = xl.read('./basic.xls');
// node-xlrd using open
xl.open('./basic.xls', showAllData);
function showAllData(err, bk) {
if (err) {
console.log(err.name, err.message);
return;
}
bk.sheets.forEach(function (sht, sIdx) {
var rCount = sht.row.count,
cCount = sht.column.count;
console.log('Sheet[%s]', sht.name);
console.log(
' index : %d, row count : %d, column count : %d',
sIdx,
rCount,
cCount
);
for (var rIdx = 0; rIdx < rCount; rIdx++) {
for (var cIdx = 0; cIdx < cCount; cIdx++) {
try {
console.log(
' cell : row = %d, col = %d, value = "%s"',
rIdx,
cIdx,
sht.cell(rIdx, cIdx)
);
} catch (e) {
console.log(e.message);
}
}
}
});
}