Paste the SQL results to a specific cell in Excel

R

Rick

Hi
Does anyone know wheather we can automatically paste the
result of a SQL to the excel sheet?

Thanks
 
O

onedaywhen

Yes, but it may need some experimentation to get it correct. For
example, for this Northwind query, in which cell would you expect the
result to appear?

INSERT INTO
[Excel 8.0;HDR=No;database=C:MyWorkbook.xls;].[MySheet$A2:A2]
(F1)
SELECT CompanyName AS F1
FROM Customers
WHERE CustomerID='ALFKI'

It can be more preictable if you have a 'column header' in the cell
above and use HDR=YES in the connection string.
 
Top