用xlsx.core.min.js将excel转成table标签



  
    
    Excel批量处理
    
    

    

    
  

  
    
    

参考: 1.JS读取和导出excel示例

2.https://www.cnblogs.com/ajaemp/p/12880847.html

大多数用原生网络请求获取表格

 function readWorkbookFromRemoteFile(
        url = "http://192.168.1.79:48080/qc/jmreport/exportAllExcelStream",
        ops,
        callback
      ) {
        let pam = {
          excelConfigId: "814637285884583936",
          queryParam: {
            currentPageNo: "1",
            currentPageSize: 10,
            pageNo: "1",
            pageSize: 10,
            token: "084c6062ab374b29b2e6f66230018f57",
          },
        };
        var xhr = new XMLHttpRequest();
        xhr.open("post", url, true);
        xhr.setRequestHeader("Authorization", "Bearer " + pam.queryParam.token);
        xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
        xhr.send(JSON.stringify(pam));
        xhr.responseType = "arraybuffer";
        xhr.onload = function (e) {
          if (xhr.status == 200) {
            let data = new Uint8Array(xhr.response);
            let workbook = XLSX.read(data, { type: "array" });
            if (callback) callback(workbook);
            console.log(data, workbook);
            readWorkbook(workbook);
          }
        };
      }

      setTimeout(() => {
        readWorkbookFromRemoteFile();
      }, 1000);

 

你可能感兴趣的:(excel,javascript,开发语言)