SELECT * FROM Excel Spreadsheet

Here is how to access data in an excel spreadsheet, from a SQL login.

SELECT * FROM OPENROWSET(‘Microsoft.Jet.OLEDB.4.0’,
‘Excel 8.0;Database=c:table.xls;HDR=YES’,
‘SELECT * FROM [Sheet1$]’)

You can also link the spreadsheet to a table.

SELECT * FROM OPENROWSET(‘Microsoft.Jet.OLEDB.4.0’,
‘Excel 8.0;Database=c:\update_asms.xls;HDR=YES’,
‘SELECT * FROM [Sheet1$]’) x INNER JOIN   invoices o on x.invoice = o.invoice

This means you can update tables based on data in spreadsheet without having to do the import into a table malarky.

sql-query-excel