I have a program to write the cells of a big excel file.(About 40 Mega Bytes).
I found it's very slow even just a move that writing a cell only. This is what I do for my project.
Excel.Workbook apoWorkBook = _Excel.Workbooks.Open(apo);
Excel.Worksheet apoWorkSheet = apoWorkBook.Worksheets[1];
Excel.Range apoRange = apoWorkSheet.UsedRange;
Then when I am going to write a cell like this:
apoRange.Cells[target_row, 23].Value2 = "Value"; // ( Repeats in different rows and columns )
It spends about 20 or more seconds to finish this line of source codes.
But I have many many same codes to write like this. This would spend so much time to finish it.
I made an experiment to write to a small empty excel file, it only used about < 0.1 seconds to do that.
I think it's very slow to write to a big excel file because it's like the program saves the file after writing to a cell every time.
What's the fastest way to write in an BIG excel file ? Can it be just like puting all values on the cells then just save at once.
Please help, thanks !