Need help in reading xlsx table directly (without converting to CSV)?

edited September 2016 in p5.js

Hi all,

I am lost on google trying to find an example, am using p5.js (not expert). If you can help in small example and what library i need to use?

Appreciate your help, Firas.

Tagged:

Answers

  • This question is asked periodically on the forum, but seldom answered.

    That silence may be because parsing xlsx directly rather than exporting / converting them is almost always a lot of work and usually a bad idea -- xlsx files can be really, really complicated and difficult to read, and there are many ways they can fail.

    There was a sketch for Processing 2 (not Processing 3 or p5.js) that did this.

    https://conorblack.wordpress.com/2014/03/23/export-import-processing-excel-xlsx/

    See also the XlsReader library in the Processing 2 (not 3) contribution manager and on github:

    https://github.com/fjenett/xlsreader-library-processing

    However, if you are trying to work with xlsx files and p5.js, better advice might be to run a csv conversion script (doesn't have to be processing) separately (e.g. on upload) and then run the sketch on the csv file.

  • Thank you Jeremy, I totaly agree, in my case the xlsx file has 3 tables on one spreadsheet, i'll try saving full file as csv.

    I found https://github.com/SheetJS/js-xlsx is it possible to use it in p5.js ?

  • If you have a static xlsx file with three different tables in it, why not save three different csv files -- one for each table -- using Excel > Save As > CSV?

    Then use loadTable() in your sketch.

    I'd have more specific advice, but I don't know what your data is or what your sketch is trying to do with it.

  • my aim to simplify the steps as much as possible, but if its not possible, i'll convert the file to a friendly format.

    csv looks simple to read, i didnt look in to how yet :) also xml can be an option too, what do u think ?

  • It really depends again on what your data is and what your sketch will do with it.

    If you have a bunch of numbers or strings arranged in simple columns and rows, saving as csv + loadTable will probably be a much easier option.

  • thanks Jeremy, will work on it today and will share the results :D

Sign In or Register to comment.