title: How to get cell data from Excel in F# (with appropriate typing)
body: <p>I am trying to read some data from excel. The value is being stored as an obj type, but when I try to cast it to an int or double type I get a type error.</p>
  
  <p>My code:</p>
  
  <pre><code>open System
  open System.Data
  #r "Microsoft.Office.Interop.Excel"
  open Microsoft.Office.Interop
  
  let xl = new Excel.ApplicationClass()
  let wb = xl.Workbooks.Open(@"Y:\Test.xlsx")
  let Sheet1 = wb.Worksheets.["Sheet1"] :?&gt; Excel.Worksheet
  let tr= Sheet1 .Cells.[1,3]:?&gt; int
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>System.InvalidCastException: Specified cast is not valid.
       at &lt;StartupCode$FSI_0018&gt;.$FSI_0018.main@() in Y:\Script2.fsx:line 20
        Stopped due to error
  </code></pre>