Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 importing from Excel

Author  Topic 

RohitGoyal2002
Starting Member

6 Posts

Posted - 2009-01-17 : 13:12:30
How can i import data from excel when column name starts from 2 row in excel sheet?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-17 : 13:15:32
http://weblogs.asp.net/mikebosch/archive/2007/10/26/ssis-skipping-rows-and-stripping-subtotals.aspx
Go to Top of Page

RohitGoyal2002
Starting Member

6 Posts

Posted - 2009-01-19 : 00:48:57
I use the following query
SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=D:\A G Edwards_2008-07-14_Weekly.xls;Extended Properties=Excel 8.0')...[ag$A2:Z2000]

It produces the error
Msg 7314, Level 16, State 1, Line 2
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" does not contain the table "ag"$A2:Z2000"". The table either does not exist or the current user does not have permissions on that table.

When i run the same query without A2:Z2000 all the rows are tranfered to SQL

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-19 : 02:18:22
i think it should be

SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=D:\A G Edwards_2008-07-14_Weekly.xls;Extended Properties=Excel 8.0','SELECT * FROM [ag$A2:Z2000]')
Go to Top of Page

RohitGoyal2002
Starting Member

6 Posts

Posted - 2009-01-19 : 06:47:15
thanks visakh16 the updated query is running

Will you please throw some light on
SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=D:\A G Edwards_2008-07-14_Weekly.xls;Extended Properties=Excel 8.0')...[ag]

When i run the above query it is running fine but same is not running with the row parameters inside this
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-19 : 09:37:48
what row parameters? can you explain that?
Go to Top of Page
   

- Advertisement -