EXPORTING MULTIPLE SQL QUERIES INTO ONE EXCEL FILE

One File To Rule Them All

Sometimes you want to run several queries and output the results into one Excel file. Typically each query result needs to go into a separate sheet in the same file. Let me show you how to do this with AutoSQL.

Create Excel file with first query

The first action needs to create a new Excel file. Therefore choose the ‘Overwrite’ option in the output options. To make sure it is written to its own Excel sheet, specify this in the ‘Use worksheet’ field:

Select Overwrite

Append the next queries into the same Excel file

To write the other queries to the same file, use the same name but choose append and choose a different output sheet name:

Select Append

If you know the number of columns that is generated by the query, you could actually also choose the same sheet, with a different cell to start. This way they will be put next to each other in the same sheet.

Execute all of them and see the result

If you run this in the background, it will create the Excel file directly with all 3 results. In the AutoSQL GUI you can run them one by one, starting with the first query. This will create the Excel file as well:

Data in one file with multiple sheets