Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Importing and exporting excel files to javascript array

I'm currently looking for a fast and efficient way to import an excel file into a javascript array, and export it also. I've tried the suggestion here:

https://stackoverflow.com/a/27474951/4346569

But the problem is that checking the console, it shows that the output are objects, so they're JSON objects? Is it because my excel file has more than 1 column? In that case, how would I be able to do this :(?

I also need a way to do the same thing, but the opposite way. Can someone advise me on that?

Thank you!

Edit: I figured importing out but now I'm stuck on how to be able to output to excel. I would need to have some cells be colored as specified by a rule. Can anyone give me some guides for this?

like image 487
Johnti Avatar asked Nov 24 '25 20:11

Johnti


1 Answers

https://www.npmjs.com/package/xlsx

here try this its quiet efficient

var workbook = XLSX.read(data, {
        type: rABS ? 'binary' : 'array',
        WTF: 1,
        header: 1 });
    console.log(workbook.Strings);

this is something i used to get array of objects

like image 86
Rahil Lakhani Avatar answered Nov 26 '25 10:11

Rahil Lakhani