node-xlrd

node.js's module to extract data from Microsoft Excel™ File(.xls)

Usage no npm install needed!

<script type="module">
  import nodeXlrd from 'https://cdn.skypack.dev/node-xlrd';
</script>

README

node-xlrd

node.js's module to extract data from Microsoft Excel™ File(.xls)

Announcements

Features

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
  • from v14 to future versions : maybe

Changelog

0.3.10

  • modifed a example script
  • fixed biff 7 issues
    • decode error
    • parsing issue
  • set up a test workflow
  • updated Readme

0.3.9

  • fixed date parsing error
    • when cellType is date, the value of month is incorrect

More Changelog

API Reference

The API reference documentation provides detailed information about a function or object in node-xlrd.js.

Installation

  • Latest stable release(curent v0.3)
npm i node-xlrd --save
  • Latest beta release (current v1.0.0-rc)
npm i node-xlrd@beta --save

Usage

var xl = require('../lib/node-xlrd');

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);
        }
      }
    }
  });
}

Examples

License

This project is licensed under the BSD license.