View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ITContractor ITContractor is offline
external usenet poster
 
Posts: 2
Default EXCEL Spreadsheet CELLS have data but load as NULL

Greetings,

I've been trying to load the EXCEL Spreadsheet:
http://tonto.eia.doe.gov/dnav/pet/pe...dcus_nus_w.htm
HTTP downloaded using the "Download Series History" link.
into SQL Server 2005 using SSIS.

In two cases:

1. Using an "EXCEL Connection Manager" and an "EXCEL Source" object
AND
2. "Script Task" code:
Dim cnn As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;Data
Source=F:\DOE-EIA\SSIS Production Sub-Directories\SSIS
Import\PET_PRI_GND_DCUS_NUS_W.xls;Extended Properties=""Excel 8.0;HDR=YES;""")
Dim da As New OleDb.OleDbDataAdapter("Select * from [1-Weekly Retail
Gasoline and Di$]", cnn)
Dim ds As New DataSet("ExcelFile")
Dim column As Int32
Dim row As Int32
Dim cellData As String

da.Fill(ds)

For row = 221 To 222 'ds.Tables.Item(0).Rows.Count
For column = 0 To 4 '(ds.Tables.Item(0).Columns.Count - 1)
If ds.Tables.Item(0).Rows(row).Item(column) Is DBNull.Value
Then
cellData = "NULL"
Else
cellData =
CType(ds.Tables.Item(0).Rows(row).Item(column), String)
End If
MsgBox(cellData, MsgBoxStyle.Information, "ExcelData")
Next column
Next row

The second, third and fourth colunms (among others) of the Speradsheet

return NULL values although the Spreadsheet obviously contains data
in
those cells.

Any ideas are appreciated.