0

I am planning to create a stored procedure that will query certain information from a database then write the information to the Excel file. I am planning to execute the stored procedure via Windows Task Scheduler. I have already created the queries but what is lacking is the command that would write to the Excel file. This is for the purpose of auto reporting. I've read about the OPENROWSET but have no idea how it works.

Thanks for your answers in advance.

1 Answer 1

1

Don’t use OPENROWSET it is read-only. Use the OPENDATASOURCE you can read & write data into it.

Insert into 
OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0', 'Data Source={Your Excel File Path};Extended Properties=Excel 8.0')...[SheetName$]
Values (....)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.