Hi,
I need to overwrite data in an excel file that I populate with a sql query. If I just use an insert statement with openrowset the data gets appened to the existing data in the excel worksheet. How do I delete the data first or overwrite it? I try to use openrowset and opendatasouce with a delete statement but it fails.

This works

SELECT * from
OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\rebecca\temp\users.xls;Extended Properties=Excel 8.0')...[Sheet1$]

------------------------------------------------------
This fails

Delete from
OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\rebecca\temp\users.xls;Extended Properties=Excel 8.0')...[Sheet1$]

with error
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" returned message "Syntax error in FROM clause.".
Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing the query "DELETE FROM Sheet1$ " for execution against OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


Do I need to setup a linked server for a delete or overwrite of a worksheet?

Thanks