You should really re-think the process; both HTML and Excel (in this instance) are filling the
Presentation Layer.
It would be much more efficient and a better architecture to do a parallel creation of the HTML and XLS(x). The way to do this would be to create the
cells in both simultaneously.
How to do this is going to depend on how the data is within the program. Without the code of how you are creating the HTML variant it is hard to know, so I am going to assume you are using some type of loop for this flowchart
1_. Creation of documents
1a. Create new Excel document
1b. Keep existing Stringbuilder
2_. Begin Loop
2a. Add a cell to the XLS
2b. Add a <TD> to the HTML
2x. End Loop
3_. Presentation
3a. Save the XLS, offer for download?
3b. Return the HTML