title: Invalid Cast Exception When Reading Data From Excel In SSIS
body: <p>I am trying to read particular cell values of Excel and store in a table. But receiving an Invalid cast exception. Below is my code in VB Script:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim oExcel As Object = CreateObject("Excel.Application")
  Dim FileName As String
  FileName = Variables.FileName
  Dim oBook As Object = oExcel.Workbooks.Open(FileName)
  Dim oSheet As Object = oBook.Worksheets(1)
  Output0Buffer.AddRow()
  Output0Buffer.OrgName = oSheet.Range("A4").Value
  Output0Buffer.UnitName = oSheet.Range("B6").Value
  Output0Buffer.MonthName = oSheet.Range("A8:A19").Value
  Output0Buffer.Goals = oSheet.Range("B8:B19").Value
  Output0Buffer.Actual = oSheet.Range("C8:C19").Value
  </code></pre>
  
  <p>The Error Message is: </p>
  
  <blockquote>
    <p>System.InvalidCastException: Conversion from type 'Object(,)' to type 'String' is not valid</p>
  </blockquote>
  
  <p>Can someone please help me identify the issue and provide a resolution?</p>