How to use the xlsx.readFileSync function in xlsx

To help you get started, we’ve selected a few xlsx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lessfish / funny-node / excel-reader / excel-reader.js View on Github external
// 引入 xlsx 模块
// https://github.com/SheetJS/js-xlsx
var xlsx = require("xlsx");
var fs = require("fs");

// workbook 对象表示整份 Excel 文档
// 一个 workbook 对象包含了 N 个 sheets(看 Excel 文档的左下角)
var workbook = xlsx.readFileSync('example.xlsx');


// 打印出每个 sheet 的 name
for (var i in workbook.SheetNames)
  console.log(workbook.SheetNames[i]);

// 获取第一个 sheet 的名字
var firstSheetName = workbook.SheetNames[0];

// 获取第一个 sheet 对象
// 通过表名获取表格
var sheet = workbook.Sheets[firstSheetName];

// 返回表的有效范围
// A1:E180
// console.log(sheet['!ref']);
github zeit / pkg / test / test-79-npm / xlsx / xlsx.js View on Github external
'use strict';

var path = require('path');
var xlsx = require('xlsx');

var xls = xlsx.readFileSync(path.join(__dirname, 'registry.xls'));
var ods = xlsx.readFileSync(path.join(__dirname, 'ffc.ods'));

if ((xls.Strings.length > 50) &&
    (ods.SheetNames.length > 0)) {
  console.log('ok');
}
github zeit / pkg / test / test-79-npm / xlsx / xlsx.js View on Github external
'use strict';

var path = require('path');
var xlsx = require('xlsx');

var xls = xlsx.readFileSync(path.join(__dirname, 'registry.xls'));
var ods = xlsx.readFileSync(path.join(__dirname, 'ffc.ods'));

if ((xls.Strings.length > 50) &&
    (ods.SheetNames.length > 0)) {
  console.log('ok');
}