Skip to main content
6-Contributor
April 10, 2024
Solved

Exporting CSV with multiple sheets

  • April 10, 2024
  • 1 reply
  • 12318 views

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!

Best answer by Rocko

There is no such thing as a Sheet in a CSV. Sheets are an Excel concept. If you manage to put sheets into a CSV, it's not CSV anymore.

 

If you know Java, it should be fairly easy to take the extension I mentioned here and enhance it to support sheets in Excel exports.

1 reply

Rocko
19-Tanzanite
April 10, 2024

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.

6-Contributor
April 10, 2024

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
19-Tanzanite
April 10, 2024

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.