title: Blank cell is ignored and overwritten in Excel.Range using Interop
body: <p>have data in an excel file as shown below, where row 1 &amp; 2 are considered as header row which will be copied when this particular file is split according to the first column.  </p>
  
  <p><img src="https://i.stack.imgur.com/Dz09n.jpg" alt="enter image description here"></p>
  
  <p>After split the files look like as below: </p>
  
  <p><img src="https://i.stack.imgur.com/dIhQp.jpg" alt="enter image description here"> <img src="https://i.stack.imgur.com/YEZ1b.jpg" alt="enter image description here"></p>
  
  <p>The <strong>Problem</strong> is that Column D's value is copied to the wrong column that is C in this case.</p>
  
  <p>I presume I need to check if a cell is empty or null and put blank/null value to the new file during write. Question is how can incorporate that into my following code? </p>
  
  <pre><code>    private FileEntity GetFileObject(Excel.Range range)
      {
          FileEntity fileEntity = new FileEntity();
          fileEntity.RowValues = new List&lt;RowEntity&gt;();
  
          for (int rowCount = 1; rowCount &lt;= range.Rows.Count; rowCount++)
          {
              RowEntity rowEntity = new RowEntity();
              rowEntity.ColumnValues = new List&lt;string&gt;();
  
              for (int columnCount = 1; columnCount &lt;= range.Columns.Count; columnCount++)
              {
                  if ((range.Cells[rowCount, columnCount] as Excel.Range).Value != null)
                  {
                      rowEntity.ColumnValues.Add((range.Cells[rowCount, columnCount] as Excel.Range).Value.ToString());
                  }
              }
              fileEntity.RowValues.Add(rowEntity);
          }
          return fileEntity;
      }
  </code></pre>