How to read data From *.CSV file using javascript?

后端 未结 13 790
不知归路
不知归路 2020-11-22 00:46

My csv data looks like this:

heading1,heading2,heading3,heading4,heading5,value1_1,value2_1,value3_1,value4_1,value5_1,value1_2,value2_2,value3_2,val

13条回答
  •  梦如初夏
    2020-11-22 01:16

    You can use PapaParse to help. https://www.papaparse.com/

    Here is a CodePen. https://codepen.io/sandro-wiggers/pen/VxrxNJ

    Papa.parse(e, {
                header:true,
                before: function(file, inputElem){ console.log('Attempting to Parse...')},
                error: function(err, file, inputElem, reason){ console.log(err); },
                complete: function(results, file){ $.PAYLOAD = results; }
            });
    

提交回复
热议问题