在sheetjs中创建新列

时间:2019-12-23 07:59:59

标签: javascript excel vue.js new-operator sheetjs

我正在使用sheetjs查找excel单元错误。我想做的是用新数据覆盖第一列。我找到了行而不是列的解决方案。

我的代码如下:

  let data = e.target.result, 
  fixedData = excelAll.fixdata(data), 
  workbook=XLSX.read(btoa(fixedData), {type: 'base64'}), 
  firstSheetName = workbook.SheetNames[0], 
  worksheet = workbook.Sheets[firstSheetName];
  results=XLSX.utils.sheet_to_json(worksheet);

  tickets=results;

  if(name=="Stok 2018 ver2.xlsx"){

    errorList=stockValidationFunctions.excelNullorNaN(tickets)

    let i
    for(i=0;i<errorList.length;i++)
    {
      lastList.push(errorList[i])
    }
    XLSX.utils.sheet_add_json(worksheet,lastList)
    XLSX.writeFile(workbook,"stokHatalar.xlsx")

    console.log(lastList)
  }
  if(name=="Reçete 2019.xlsx"){
    errorList=formulaValidationFunctions.excelNull(tickets)
    let i
    for(i=0;i<errorList.length;i++)
    {
      lastList.push(errorList[i])
    }
    XLSX.utils.sheet_add_json(worksheet,lastList)
    XLSX.writeFile(workbook,"reçeteHatalar.xlsx")
    console.log(lastList)

  }

}
reader.readAsArrayBuffer(f);

commit('handle_Drop', lastList);
},

The ss is what i want

但是我不能解决它

0 个答案:

没有答案