Export To Multiple Worksheets

Hi! New to EasyMorph. Curious about how to run multiple SQL queries and export each result set to a new excel workbook w/ one query per worksheet.

Having trouble figuring the export out.



Hi Brian,

can we assume that the SQL queries are hardcoded or they should be loaded from an external source such as a text file?

In a simple case it’s just two actions per query - “Import from database” and “Export to Excel” like in the example below.

Db-to-Excel.zip (8.6 KB)


Just have several table with the two actions each. One table per query.

In a more complex case, an iteration might be required.

Thanks! It is SQL queries grabbing data from our database. I have good luck with what you mentioned. Two actions: 1. SQL custom 2. Export to new file (create new in my case). It’s getting the 2nd and 3rd queries to execute and Create New Sheet in existing file that I have trouble with. I can’t seem to get everything to run in order.

Just create several tables with the two actions (e.g. copy/paste the table from my example).

To create new sheet in an existing file you might need to use the Synchronize action because otherwise EasyMorph will try to parallelize calculations and perform writes at the same time which will cause access violation errors.

See these topics on creating new sheets in existing file:

I’ve updated my example so that it exports multiple query results into multiple sheets of the same spreadsheet.

Db-to-Excel.zip (9.9 KB)

Since I copy/pasted tables SQL in this example all three queries are the same as I was lazy to change them :slight_smile: Of course, they can be different.