I am currently using Microsoft's Microsoft Office Interop Excel in order to insert 28k row into an Excel file.
It should look like this (with 28k rows instead of 31):
I am inserting the data in the following foreach loop:
foreach (var displayableProduct in DisplayableMATProductList)
{
Worksheet.Cells[row, column] = displayableProduct.MATProduct.MATProductNumber;
column++;
if (displayableProduct.MATProduct.tblFormat != null) Worksheet.Cells[row, column] = displayableProduct.MATProduct.tblFormat.FormatName;
column++;
if (displayableProduct.MATProduct.tblGrade != null) Worksheet.Cells[row, column] = displayableProduct.MATProduct.tblGrade.GradeName;
column++;
if (displayableProduct.MATProduct.tblProduct != null) Worksheet.Cells[row, column] = displayableProduct.MATProduct.tblProduct.ProductCASNumber;
column++;
Worksheet.Cells[row, column] = displayableProduct.ProductInflammabilityLevel;
column++;
Worksheet.Cells[row, column] = displayableProduct.ProductToxicityLevel;
column++;
Worksheet.Cells[row, column] = displayableProduct.ProductReactivityLevel;
column++;
Worksheet.Cells[row, column] = displayableProduct.ProductSpecialLevel;
column++;
row++;
column = 1;
}
However, the problem is that the operation is taking about 10 minutes.
Does anyone know a faster way to insert bulk data into an Excel Worksheet?