Export to excel template

Hi,

Is it possible to import a sql query result and export to specific fields in an excel Template?

Yes, it’s possible.

  1. Have an Excel template with two sheets - “Data” (with data as a table) and “Result” (with formatted fields with references to the “Data” sheet).
  2. Clone the template with the “File command” action before populating it with new data.
  3. Query a database, then export it into the “Data” sheet. Excel will automatically update the “Result” sheet.

See the “Inc5000” example that comes pre-installed with EasyMorph. It queries a database and populates an Excel template in which a chart is updated with the data inserted by EasyMorph.

Thank you, I will give it a go.

I have a template, and if I just paste the sql query results into the data tab under the headings, the results tab refreshes perfectly. However, when I export the query results to the data tab (using: Replace sheet/range in existing file ), the data writes to that tab fine, but the results do not refresh. Any thoughts?

Try using the “Excel command” action, the command “Re-calculate workbook” after exporting.

Also, you can add a pivot table that references the dataset on the data tab and use the pivot table in the formatted sheet, or for providing values for the formatted sheet. In the pivot table settings, tick “Refresh data when opening the file”.

1 Like

Thank you I will give that a go.

That was the winner :slight_smile: I'd love to learn more about EM especiall on the reporting section. I'll keep playing. Thank you...!