Parse XLSX in Javascript to get JSON file with input fields

I have an excel file and i am interested in to parse this excel file and get inputfields which are in it. Anyone has already did such kind of task or have some suggestions. please let me know. I could not find any resource about it. I am javascript developer.

thank you

Do you want to enter the extracted data into a Base database (according to your tag)? Or is it a “theoretical” question not related directly to LibreOffice?

1 Like

I have few excel files which are checklists and that i would like to make in thingwox mashup( which is UI) so i dont have to create all designs manually in UI because i have around more then 100 excel files. Thats why i would like to do this automation. Thingworx is IOT platform and there i would like to make UI for each checklist.

I am considering below approach…

[ LibreOffice macro in Python or JavaScript, which parses XLSX ] --[ JSON file with input fields ]–> [ A Python or Node.js script, which generates a mashup XML ] → [ Package all those generated mashup XMLs as an extension and import it into ThingWorx ].

If I understand you correctly, you want to use LO Calc to “decode” XLSX files into some “editable” structure. Then you traverse the “DOM” (document object model) to translate into some other representation. Calc will effectively do approximately the parsing step. I write approximately because LO Calc is not M$ Excel and you should always expect differences and incompatibilities.

The second step can probably be done with LO macros written in Python. I hope contributors versed in Calc internals will answer this part.

I’ll retag your question because it has nothing to do with the LO database frontend called Base. Understand also that what’s you’re asking is kind of corner case in Calc usage. I am not sure that a lot of users (yes, we’re users like you) will answer.

To help people, please mention OS name and exact LO version.

1 Like

Thanks for your feedback! I can understand that the parsing would give me results which would not be 100 percent according to excel and thats also my expectation.

Is it possible for you to share with me may be an example that how can i parse the excel in LO ?

If you already think python, why not skip LibreOffice and use a library to read xlsx directly in Python?
Openpyxl for example:
https://openpyxl.readthedocs.io/en/3.1/tutorial.html

On the other hand: Simple Excel you may be able convert to csv for your purpose. There are command-line options in LibreOffice for this.

1 Like

Thanks! I like the idea and actually i am JavaScript developer so i have tried with JS library Sheet.js which is extremely powerful and giving results more then one can expect. I am able to parse excel and get the cells height widget and cell type if its checkbox or textfield or image(with placeholder), then its also giving result of how many textfields(cells) are there in one row which is also important for me afterwards to design the page from this json information.

If i get any query then i ll write it down here.

1 Like