cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Exporting CSV with multiple sheets

BK_10290693
5-Regular Member

Exporting CSV with multiple sheets

Hello,

I want to export data into csv file as similar to data export widget, but it should take more than 1 infotable input and should give output as the csv file
with more than 1 sheets containing the data from those infotables.

I there any similar custom widget available to such requirement. Please suggest.

Thanks!

4 REPLIES 4
Rocko
17-Peridot
(To:BK_10290693)

CSV does not have sheets, only Excel does. See https://datatracker.ietf.org/doc/html/rfc4180#section-2 for comparison.

You could create multiple files in a file repository and concatenate them in a service.

BK_10290693
5-Regular Member
(To:Rocko)

Is there any possible way to achieve this by exporting as an excel file rather exporting to csv. That will also work for me.

 

Also, on this point of yours, "You could create multiple files in a file repository and concatenate them in a service."- Are you suggesting the service to be a thingworx service.

Please suggest.

 

Thanks.

Rocko
17-Peridot
(To:BK_10290693)

To write complex formats like Excel you have have to create an extension (or use an existing one like this) which uses HSSF to create the Excel files.

For CSV, you could create a TWX service which just iterates the infotable(s) and writes the values as CSV into a file in a File Repository, The service would then return the link to the file.

 

 

@BK_10290693 , The ThingWorx out of the box, does not contain the ability to export an Excel file. If you are willing to create an extension there is a library (Apache POI API). This library can be included as part of the extension. It would support export/import of Excel and CSV data. The library can be located at Apache POI
You would need to write the code to interface between ThingWorx and the calls to the Apache POI library.  
If you have general questions I would be happy to share what little I know.

Good Luck

Peter

Top Tags