The first thing that comes to mind when seeing your code is changing this if (sheet.GetRow(i).Cells[col].ToString() == "ATM") ATM = col; else if (sheet.GetRow(i).Cells[col].ToString() == "Card-AMEX") AMEX = col; else if (sheet.GetRow(i).Cells[col].ToString() == "Card-MASTER") MASTER = col; else if (sheet.GetRow(i).Cells[col].ToString() == "Card-VISA") VISA = col; else if (sheet.GetRow(i).Cells[col].ToString() == "Cash") CASH = col; To the following (it might seem like more lines of code, but its way more readable and doesn't repeat `sheet.GetRow(i).Cells[col].ToString()` 5 times. switch(sheet.GetRow(i).Cells[col].ToString()) { case "ATM": ATM = col; break; case "Card-AMEX": AMEX = col; break; case "Card-MASTER": MASTER = col; break; case "Card-VISA": VISA = col; break; case "Cash": CASH = col; break; } Also, try not to repeat doing the same thing over and over again. ie. you call `sheet.GetRow(k)` so many times. Instead create a variable and call it once and use that variable. Same concept as above and as a bonus, you will get a performance increase.