title: Excel Interop - Efficiency and performance
body: <p>I was wondering what I could do to improve the performance of Excel automation, as it can be quite slow if you have a lot going on in the worksheet...</p>
  
  <p>Here's a few I found myself:</p>
  
  <ul>
  <li><p><code>ExcelApp.ScreenUpdating = false</code> -- turn off the redrawing of the screen</p></li>
  <li><p><code>ExcelApp.Calculation = Excel.XlCalculation.xlCalculationManual</code> -- turning off the calculation engine so Excel doesn't automatically recalculate when a cell value changes (turn it back on after you're done)</p></li>
  <li><p>Reduce calls to <code>Worksheet.Cells.Item(row, col)</code> and <code>Worksheet.Range</code> -- I had to poll hundreds of cells to find the cell I needed. Implementing some caching of cell locations, reduced the execution time from ~40 to ~5 seconds.</p></li>
  </ul>
  
  <p>What kind of interop calls take a heavy toll on performance and should be avoided? What else can you do to avoid unnecessary processing being done?</p>