Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 引入 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']);
'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');
}
'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');
}