Export data into excel on webclient

Dear Expert.
I’m building Web client project.
In which, I need export some data into excel file from web client.
I don’t know how can I do that because.

  1. Code behind web client display is java. I don’t know how import and use external library in it.
  2. If using task script, it mean that script will run on server machine. And machine running web client runtime can using this script.
    Please help me.
    Best

Hi Thanos,

We have prepared an example project for you, demonstrating how to generate a .csv file on the client side.

The example contains two methods: one prepares the file for download, and the other extracts data from a DataGrid. The parameter used by the second method is the Uid, which you can edit and obtain from the Design tab, as shown in the following image.

image

Below is the link to download the example project.

If you have any questions, we are available.

Best Regards,
Bruno Nunes.

Dear Expert.
Thanks for your support.
csv format isn’t my target, because csv format has many limitations.
My target is xlsx file.
In other software which use javascript as VB code, I can use excel.js library and working with xlsx file easily. But, I don’t know how can i use it in factory studio.
Or do you have any other solutions in order to working with xlsx file ?
Best

Hi Thanos,

In your code, on line 46, you can replace var fileName = ‘NEWReport01.csv’; with var fileName = ‘NEWReport01.xlsx’;. This should solve your problem.

In tests conducted in our laboratory, the .xlsx file was generated successfully.

image

Could you please perform the test and provide us with feedback if this solution works for you?

If you have any questions, we are available.

Best Regards,
Bruno Nunes.

Dear expert
Thank for your feedback.
Did you try to open xlsx file after download.
I tried to do that. But the value of content variable not compatible with with xlsx file. So the open procedure had error.
Please check
Best.