I'm mainly parsing large amounts of text from a text file and then populating it into an excel.
//populate into worksheet
for (int x = 0; x < rawLine.Length; x++)
{
string[] tempLine = rawLine[x].Split(';');
for (int y = 0; y < tempLine.Length; y++)
{
DateTime hour = Convert.ToDateTime(tempLine[6]);
xlWorkSheet.Cells[y + 2, 1] = tempLine[0];
xlWorkSheet.Cells[y + 2, 2] = tempLine[1];
xlWorkSheet.Cells[y + 2, 3] = tempLine[2];
xlWorkSheet.Cells[y + 2, 4] = tempLine[3];
xlWorkSheet.Cells[y + 2, 5] = tempLine[4];
xlWorkSheet.Cells[y + 2, 6] = tempLine[5];
xlWorkSheet.Cells[y + 2, 7] = tempLine[6];
xlWorkSheet.Cells[y + 2, 8] = tempLine[7];
xlWorkSheet.Cells[y + 2, 9] = tempLine[8];
xlWorkSheet.Cells[y + 2, 10] = tempLine[9];
xlWorkSheet.Cells[y + 2, 11] = tempLine[10];
xlWorkSheet.Cells[y + 2, 12] = hour.Hour;
xlWorkSheet.Cells[y + 2, 13] = tempLine[8] == "0" ? "SAME" : tempLine[9];
}
Console.WriteLine("Current line = " + x + "\n");
}
Currently this code works, but it's just taking way too long. Is there anyway to speed it up? I have done some searching but found nothing much specific.
Thanks in advance.