It could help in the long run to have the ability to toggle saving in excel activities, either per activity (preferred) or as a transaction-like scope.
There are use cases with legitimate reason to iterate over cells and modify something about them (latest being changing cell colors that are not a full range).
If there would be a boolean flag for those to not save immediately, it could save a lot of execution time. For compatibility reasons default should remain to save.
Major candidates for this addition would be WriteCell and SetRangeColor, but others could use it as well (AppendRange, WriteRange etc.).
As a secondary effect this would require an explicit ExcelSave activity, or other make-sure-its-saved mechanism.
While this may sound risky at first (users not saving their changes), with a proper default behaviour it would give more control and also allow effective manipulation of individual cells, which currently is a performance killer.
I don’t know if I’m understanding this correctly, but in the meantime why not to collect all data and lastly work on the excel file all you might need, so you don’t necesary close it and therefore save it? - I know you have think about this -
Because you are saying that after executing certain activity excel will save itself automatically? I am running big data and keep me saying that I am out of memory (8g ram, excel64b)
From a quick test (and others findings as well), it is. ExcelSaveTest.xaml (7.3 KB)
Execution times, .tmp files popping up, last file write time (if you put delays in or use a file watcher) etc. all confirm that it does. Can’t confirm 100% from source, though, for obvious reasons
The file is saved after any writing or modification brought to it. It should be best to save once, at the end of the Excel Application Scope.
But I don’t think it will come up very soon. @Lavinia?
What about Cancellation/Faulted when saving only at end?
However you decide it will be best, please add a specific documentation to it - right now it’s simple, it might not be in the future if you give more control to the designer
You know it was a contrived example just to illustrate functionality
It’s not always feasible to operate on continous, rectangle ranges. Especially for changing cell colors, which are usually either per row, or even per cell.
(Btw - why is there only SetRangeColor, but not SetCellColor?)
Besides, essentially same idea is already marked as planned - there is demand for it
To be honest, as far as I’m concerned if you’d just disable saving in all ExcelScope activities and add a SaveWorkbook activity (or not even that - there’s always Invoke -> wb.CurrentWorkbook.Save) I’d be happy