Expand my Community achievements bar.

SOLVED

Convert MS Excel Table to JSON in Adobe LiveCycle Form using JavaScript

Avatar

Level 8

I followed the steps as per this video:

Convert Excel to JSON with Javascript - YouTube

and I was able to convert a table from MS Excel to Json in using JavaScript in Chrome and IE Browsers.

I was wondering if we are able to import this library script:

js-xlsx

into Script Objects in Adobe LiveCycle Designer Form, will we be able to follow similar approach to retrieve data from MS Excel Sheet into a Json Object in Adobe LiveCycle Form using JavaScript?

Is there an alternative method or something similar?

The idea is to improve efficiency when communicating with the business users. The BA team usually provides business related data in MS Excel which eventually need to be imported into the program. If we can automate even 80% of this information exchange process between the business and technical team, we will be able to minimize errors, and speed up the process of delivering features to the end-users, and be ahead of our competitors.

Tarek

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Tarek,

I've never needed to try anything like this, but remembered a post by John Brinkman, which might help?

Display an XML Spreadsheet

The boundary points are always a pain, but XML or JSON are probably easier formats.

Regards

Bruce

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi Tarek,

I've never needed to try anything like this, but remembered a post by John Brinkman, which might help?

Display an XML Spreadsheet

The boundary points are always a pain, but XML or JSON are probably easier formats.

Regards

Bruce

Avatar

Level 8

Thank you Bruce, that was pretty close to what I was looking for. I did test it with Excel file I had, and it worked.

I think with a some additional study and research, I will be able to get Json Object. I honestly thought that something like this cannot be done in xfa JavaScript.

I didn't follow you on the above statement, what do you mean?

I also was wondering if it is possible in principle to port the library :

js-xlsx

into script objects in xfa form?

Tarek

Avatar

Level 10

Hi Tarek,

I have converted some libraries to use in XFA forms, but not this big.  Should be easier in Reader DC which supports Uint8Array as well as some other ES5 things like JSON.parse and new Date('yyyy-mm-dd'). We don't have a Blob object, but maybe that would need to change to a Data object anyway, I only had a very quick look.

A common problem converting JavaScript code is in Reader we can't override the toString or valueOf methods so we need to come up with slightly difference names (I use _valueOf), it gets tricky as these can be implicitly called depending on if the context is string or numeric, so is easy to miss.

I'm not sure what I meant by my comment now, might have been thinking it would be clumsy for the end user or difficult to code.

Good luck

Bruce