Hi,
I’m working on a Reactive Web App in OutSystems. I want to let the user upload an Excel file, read its data, make some changes, and then save/download the updated file — all on the client side using JavaScript and SheetJS (xlsx.js). I tried reading the file using SheetJS, but I'm getting an error. It seems there’s an issue with the binary data format, and I couldn’t read the file properly. Has anyone done this in OutSystems? What is the correct way to read an Excel file using JavaScript in a Client Action?
Any example or help would be really appreciated.
Use this method—it should work:
Download the library from the CDN:
https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js
Import it into the Scripts section of your module.
Add it to the Required Scripts property for the relevant screen or block.
This ensures the library is loaded before your JavaScript runs.
output:
Hi @Juvairiya Jabbar,
OutSystems' binary data type can store a base64 string without any additional metadata.
var workbook = XLSX.read($parameters.BinaryData, { type: "base64" });
Another approach is to convert the file into an array buffer.
If you've already tried this approach and still encountering issues, could you provide more details on how the binary file is being handled in OutSystems?
Hi Gee Kay,
Thanks for your suggestions!
I actually already tried both approaches:But in both cases, I still got the same issue — XLSX.read is not a function. I've attached a sample of what I did in the JavaScript code, in case it helps spot something I missed.
Please let me know if there’s anything else I can try — I’ve been stuck on this.
Thanks a lot for your help! I was stuck on this and tried many things, but your suggestion worked. Really appreciate it!
Hi Gee Kay,I followed the steps you provided and was able to read the file content by checking the console in the browser. I'd like to ask how I can assign that result to a local variable in OutSystems. When I try to assign it to a local variable with the data type Text, it returns an empty string ("").Thank you!
Hi Vu Ky,
You have use $resolve() in your javascript.
Refer this one - https://www.outsystems.com/forums/discussion/101970/need-to-pass-data-from-javascript-api-response-to-output-parameter-of-javscript/
Hi, I see the result and was able to assign it to a local variable. Thank you!
@Juvairiya Jabbar
In OutSystems Reactive Web applications, Screen Actions are indeed executed entirely on the client-side.
Could you share a bit more about how you are currently reading the file in your JavaScript code? Specifically, how are you accessing the file data from the file input and how are you passing it to SheetJS?