speed issue when writing to excel from c#

philky001

Board Regular
Joined
Jun 8, 2005
Messages
129
I have a small program in C# that takes a legacy report as a text file and writes to excel template. We also do the page break in the program. It takes a while to run. about 45 seconds for a template with 3 sheets, 2-6 pages per sheet.

But if we have more data, it will take longer.

I am looking for ideas to speed up this process. I was told to look at SpreadsheetML.

Is that the way to go or any other ideas?
 
Do you have the updating and calculations switched off in your code?

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.DisplayAlerts = False
'Your code
'Then switch back on
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
 
Upvote 0
Philly

What method(s) are you using for this?

Are you automating Excel in anyway?

Also how are you dealing with the text file(s)?
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top