如何将csv文件输出从垂直转换为水平?

时间:2017-07-07 02:17:20

标签: javascript csv

我有一个检索csv文件内容的函数

var reader = new FileReader();

reader.onload = function () {
    console.log("This is the file Output Format \n" + reader.result);
    reader.readAsBinaryString(fileInput.files[0]);
};

我的csv文件函数以这种格式输出文件数据:

  

456789

     

454356

     

098569

     

856995

我希望它采用以下格式:

  

456789,454356,098569,856995

如何生成如下水平文件输出? enter image description here

1 个答案:

答案 0 :(得分:0)

由于您所需的输出不包含ID,我只留下了数字:

console.log(
   "This is the wanted Output Format \n" + 
   reader.result.split(/\s+/).splice(1).join(', ')
);
相关问题