Node.js Nodejs读写excel文件的最佳实践是什么?

Node.js Nodejs读写excel文件的最佳实践是什么?,node.js,excel,npm,Node.js,Excel,Npm,是时候在StackOverflow中提问了,因为我已经找到了不止一个excel库,有些基于客户端,有些基于服务器端 首先 我使用的是Node.js,在哪里最好使用Excel库,客户端还是服务器端 秒 您知道并信任哪一个是好的Excel库? 我已尝试安装此: 但如果不进行调优,它会在CLI中引发下一个错误: module.js:544 throw err; ^ Error: Cannot find module 'excel4node' at Function.Modul

是时候在StackOverflow中提问了,因为我已经找到了不止一个excel库,有些基于客户端,有些基于服务器端

首先

我使用的是Node.js,在哪里最好使用Excel库,客户端还是服务器端

您知道并信任哪一个是好的Excel库? 我已尝试安装此: 但如果不进行调优,它会在CLI中引发下一个错误:

module.js:544
    throw err;
    ^

Error: Cannot find module 'excel4node'
    at Function.Module._resolveFilename (module.js:542:15)
    at Function.Module._load (module.js:472:25)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/razbuchnik/node/app.js:11:10)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
[nodemon] app crashed - waiting for file changes before starting...
module.js:544
犯错误;
^
错误:找不到模块“excel4node”
在Function.Module.\u解析文件名(Module.js:542:15)
在Function.Module.\u加载(Module.js:472:25)
at Module.require(Module.js:585:17)
根据需要(内部/module.js:11:18)
反对。(/Users/razbuchnik/node/app.js:11:10)
在模块处编译(Module.js:641:30)
在Object.Module._extensions..js(Module.js:652:10)
在Module.load(Module.js:560:32)
在tryModuleLoad时(module.js:503:12)
在Function.Module.\u加载(Module.js:495:3)
[nodemon]应用程序崩溃-正在等待文件更改,然后再启动。。。
这里有什么好建议吗


谢谢。

如果不安装它,您不能使用
require('excel4node')
,请尝试
npm install excel4node
安装它

您可以使用
npm install exceljs

var Excel = require('exceljs');
var workbook = new Excel.Workbook();

workbook.xlsx.readFile('old.xlsx')
    .then(function() {
        var worksheet = workbook.getWorksheet(1);
        var row = worksheet.getRow(5);
        row.getCell(1).value = 5; // A5's value set to 5
        row.commit();
        return workbook.xlsx.writeFile('new.xlsx');
    })
请参阅软件包页面中的更多信息

或者,用另一种方式回答


希望有帮助。

您是否使用了
npm安装excel4node
?是的。。。。我已经试过了是的,我刚刚找到了这个,而且效果很好。感谢您的支持。当写入缺少richText的新文件时,