Export array to Worksheet?

1 Answer 197 Views
Spreadsheet
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Ian asked on 03 Jan 2022, 11:59 AM

I'm busy converting an application which exported data to an Excel spreadsheet to one which uses only the Telerik Worksheet/Workbook control.

So far, the compatibility is excellent, but the one call which seems to exist in Excel which I can't find for the Telerik controls is one which exports a complete 2d array to the worksheet. This was needed in Excel because calls to the external programme were slow, so exporting all the data in one call call made a big difference to performance

For the Telerik controls, it looks like exporting data is more efficient (no surprise - all in the same app) , so maybe I don't need to do things this way any more, but I just want to check that this capability really doesn't exist for a Worksheet. It would mean fewer code changes.

Is this right ?

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 04 Jan 2022, 09:17 AM

Hi Ian,

It seems that you need to export the file to a CSV. This is supported, more information about this can be found in the following article: SpreadProcessing - Using CsvFormatProvider.

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Ian
Top achievements
Rank 2
Bronze
Iron
Iron
commented on 04 Jan 2022, 09:58 AM

Ah - I missed that - good idea. Thanks

Before I dive into this, do you have any ideas about the relative performance between updating each cell of the Worksheet individually, vs loading a CSV into all cells at the same time? I don't really want to keep all this old 'export 2d table' code and I certainly don't want to change it to export a CSV, unless it's really necessary?

I expect that the CSV will get better as the number of cells increases? Any ideas where the cross-over point might be ? If not, I can do some experiments myself :-(

Dimitar
Telerik team
commented on 05 Jan 2022, 09:59 AM

Hi Ian

In general, the CSV is used when you need to store the values only and you do not use formating or cell styles. When using the Xlsx format a lot more information is stored and each cell can have different properties. If you need to store the values only and you have a large amount of data I will recommend using CSV. 

If you have a lot of data, let's say more than 10 columns and 100K rows (please note that the import-export performance depends on the document complexity and the used features as well and it would be best to perform some test with your exact document) I would recommend using the SpredStreamProcessing library which is designed for such cases and allows you to directly write in the file stream without loading the entire document in the memory. More information about this is available here: SpreadStreamProcessing. Both Xlsx and CSV formats are supported. 

Should you have any other questions do not hesitate to ask.
Tags
Spreadsheet
Asked by
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Dimitar
Telerik team
Share this question
or