如何在js中将数据写入xls sheet

How to write data into an xls sheet in js

我可以将数据写入 xls sheet 但不是以正确的方式,请看下面的图片

My xls sheet

我的代码,

var readString = '';
      readString = "Name"+"\t"+" From"+"\t"+" Created By"+"\t"+" Reminder Date"+"\t"+" Reminder Time"+"\n";
      event.forEach(function (v, i) {
        readString += v.attributes.task_name+"\t";
        readString += v.attributes.context_type+"\t";
        readString += v.created_by.employee.name+"\t";
        readString += v.attributes.reminder_date+"\t";
        readString += v.attributes.reminder_time+"\t";
        readString += "\n";
      });
      var currTime = new Date().getTime();
      var filePath = "./modules/upload/excel/task_" + currTime + ".xls";
      //studentInfo.filePath = "task_" + currTime + ".xls";
      var writeStream = fs.createWriteStream(filePath);
      writeStream.write(readString);
      writeStream.close();

谁能帮忙me.Thanks。

要使用 XLS 文件,请参阅:

但是查看您的代码,您似乎正在使用 TSV 数据而不是 XLS。参见:

请注意,TSV 与 CSV 相同,唯一的区别是分隔符。