鍍金池/ 問答/HTML5  HTML/ node 使用exceljs讀取excel文件出錯(cuò),提示file node fo

node 使用exceljs讀取excel文件出錯(cuò),提示file node found

node 使用exceljs讀取excel文件出錯(cuò),提示file node found,哪位屌大的幫忙解決一下問題
下面是使用exceljs模塊讀取文件的代碼


var workbook = new Excel.Workbook();
var filePath=path.join(__dirname, "./upload/"+new_excelname);

//console.log(filePath)
workbook.xlsx.readFile(filePath)
    .then(function() {    
        // use workbook
        // Iterate over all sheets
        // Note: workbook.worksheets.forEach will still work but this is better
        workbook.eachSheet(function(worksheet, sheetId) {
          var worksheet = workbook.getWorksheet(0);
          var rowCount=worksheet.rowCount;
          var rowCount=worksheet.columnCount;
          for(let i=0;i<rowCount;i++){
            for( let j='A';j!=columnCount;j++){
              res.send(j+'-'+i)
            }
          }
        });


下面是錯(cuò)誤提示

clipboard.png

(node:60240) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: File not found: C:\Users\wenji\Desktop\njdcdss\upload\99800-2018-1-12-工 作簿1.xlsx
(node:60240) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
補(bǔ)充:文件確實(shí)在該路徑下,且文件名無誤

回答
編輯回答
爛人

如果確定代碼沒問題,試試用英文做文件名

2017年9月23日 03:11