Showing posts with label infrequently. Show all posts
Showing posts with label infrequently. Show all posts

Wednesday, March 21, 2012

Import Excel file into SQL Server

Could someone provide me with a URL that explains how to set up DTS to import an Excel file into SQL Server?

I plan to run this infrequently so there is no need to schedule a recurring run.

Thanks,
CraigHere is sample how to get rows from Excel file in SQL - use OPENDATASOURCE:

select * from OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source="\\comp\share name\filename.xls";Extended Properties=Excel 8.0')...['2005$']

where ['2005$'] is Sheet name in Excel (2005).
Format ['name$'] uses only for sheets started with digit or contained spaces.
overwise:
Sheet1$ for sheet with name Sheet1|||Thanks for the reply. I will try that.

If I can get it imported, can I include it as a temp table in queries and would I need a linked server for that?

Craig