Exporting multiple SQL queries into one excel file
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, go to ‘Optional Excel Settings’ and fill in a sheet name:
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 don’t forget to put in a specific sheet name. 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: