Is LightCellsDataProvider available in CellsforPythonvia.NET?

@SteveOlson,

LightCells API is not available in Aspose.Cells for Python via .NET. Maybe you could try using MemoryPreference mode as you are concerned with memory usage for your processes (reading big files and writing large data), see the document: Optimizing Memory Usage while Working with Big Files having Large Datasets|Documentation

Thank you! I will give that a try and see what happens and report back to this thread.

@SteveOlson,

Alright, please take your time to try to use MemoryPreference mode if it makes any difference. By the way, we have classes: LightCellsDataHandler class | Aspose.Cells for Python via .NET API References and LightCellsDataProvider class | Aspose.Cells for Python via .NET API References. We will evaluate your requirements and may devise a sample code snippet (example) for you (if possible).

Not being a python expert, I’ve not used classes yet :frowning_face:, hence a small stand alone example that simply uses LightCells to write a few hard wired cells with a few hard wired styles (yellow background ?) would be awesome. But I’ll try the memory setting first… :grinning: Also if I can integrate LightCells, I’m interested in the speed difference too.
Thanks Again!!!

@SteveOlson,

Sure, we will look into it and get back to you soon.

@SteveOlson
We’re very sorry, but since LightCellsDataHandler and LightCellsDataProvider are interfaces in .NET, we currently do not support inheriting from interfaces like this:

class MyDataProvider(LightCellsDataProvider):

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSPYTHONNET-304

Please use the MemoryPreference approach instead.

Thank you for the update. I will start integrating MemoryPreference settings.

@SteveOlson,

Sure, you may try the settings/mode and let us know your feedback.

The memory and compression options did seem to reduce the size of the spreadsheets, but more investigation by me will need to be performed to get the balance between speed and compression since I now have these options BOTH set:
options = ac.OoxmlSaveOptions()
options.compression_type = ac.OoxmlCompressionType.LEVEL9
and
wb.settings.memory_setting = MemorySetting.MEMORY_PREFERENCE

Just so you know the metrics I’m working with (200,000 rows by 282 cols wide):
Using the legacy system which focuses on shared strings and simply builds the spreadsheet file components individually and zips the contents back up (complex stuff we would rather not maintain) creates a 98 MB version of the workbook. With the memory and compression settings together, my Apsose spreadsheet (same data) is 175 MB. Interestingly when I open and then save the spreadsheet it got reduced to 116 MB (?).

The value proposition Apsose brings is very high for everything else and it wins all battles in 99% of our cases easily, so thanks again for that! I’ll continue to see what I can do the squeeze the size down in an automated fashion… (Last step: open with XLWings and close?)
Any ideas appreciated!

@SteveOlson
Could you unzip the two Excel files, then share which xml file size is reduced?
And I know it’s hard to upload so large file to dropbox or other clouds , but without files, we can not find difference.

I took the original and did an extract
image.png (50.8 KB)

Made a copy, opened and saved and opened another extract:
image.png (43.7 KB)

Most all files I see in these are very small

Looking through the files I see this:
Before save
sharedStrings.xml 33.671 kb
sheet4.xml 1,646,757 kb

after save
sharedStrings.xml 33.671 kb
sheet4.xml 834,382 kb

I’ve not worked directly with extract files in the past, so let me know if there is more info I could provide that would help.

@SteveOlson,

Thank you for sharing the screenshots and details regarding the XML file size.

We would still request you to provide the extracted XML files as well. Anyways, we will review your case thoroughly and get back to you soon.

I could do that, would it be easier to send you the before and after spreadsheets (I made a copy so I could do that)? Not sure how to do that here.

@SteveOlson
Please upload files to dropbox or other clouds as the files are too large, then share a link here. We will check them soon.

Hi, sorry, have been stacked up. I will try to get you these file by early next week. I wanted to run through some more testing.

@SteveOlson,

Please take your time to share the resource files with us. Once received, we will thoroughly evaluate your issue using the provided files.

I’ve created 4 files on dropbox. They show the files created by apsose at level 1 and level 9. The other number in the name is the seconds to create. The smaller ones are the size of the same file, if I open and make a save and close manually. They squeeze down quite a bit more after open and save.

Let me know if you cannot access the links:
https://www.dropbox.com/scl/fi/zic59hvxhjww94hgmw5nr/option_9_1900.xlsx?rlkey=3ob4tnzipt93cklettocmuizb&st=2na8fxs6&dl=0

https://www.dropbox.com/scl/fi/yl0zf7u2syxmgw5ddyv40/option_1_600_after_save.xlsx?rlkey=tqq4jvxlwz13e2qp3zej4y7wd&st=a585ernn&dl=0

https://www.dropbox.com/scl/fi/4fhzkay7n6yl2rf78um3m/option_1_600.xlsx?rlkey=eb9wk24dokbadhn96gqowrn70&st=2x8uaol6&dl=0

https://www.dropbox.com/scl/fi/6s5v1dbvgiiiegwea4478/optino_9_1900_after_save.xlsx?rlkey=kps8kavdmwtzt6xpvuyad6mfv&st=4i9x9sor&dl=0

I have to report another strange phenomenon. Before I used the save level options, my normal spreadsheets were 4 meg. When I open and save them, they are slightly smaller like 3.9 meg. So putting on save level 9, they squeezed by about 1/3 to 3 meg. When I open and save them, the get larger back to the 3.9 meg. It seems excel mod then save actually made small files worse and large files better.

@SteveOlson,

Thanks for sharing the sample Excel files and details. We will evaluate them and get back to you with updates.

@SteveOlson
There are too many empty cells in the file, if you save the file with MS Excel, MS Excel will remove all empty cells in the column and set style to column object If these cells contain same style.
Aspose.Cells does not check whether we can remove those empty cells for performance.

So please reduce empty cells with your codes. If all cells in the column contain same style, please set the style to the column (Column.SetStyle()). Then if the style of the cell is same as style of column and there is no data, please do not call Cells[row,column], then no empty cells will generated.
For example : In Column C: most of cells has same borders, so please apply borders style to the column C, then we only need to create a few Cell objects when need.

Also.

  1. We can call Cells.DeleteBlankColumns() method to remove empty columns. But this method shifts right columns.
  2. If you want to reduce the file size, you can ignore the names of the cells as the following :
    OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();
    saveOptions.ExportCellName = false;
  3. It’s better that you have to reduce empty cells.