# Automation - How to export "Execute Script" results to file?

**URL:** <https://forums.toadworld.com/t/automation-how-to-export-execute-script-results-to-file/30518>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [July 21, 2014, 9:59am UTC](https://forums.toadworld.com/t/automation-how-to-export-execute-script-results-to-file/30518 "2014-07-21T09:59:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![djacobs](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@djacobs](https://forums.toadworld.com/u/djacobs)\
**Post date:** [July 21, 2014, 9:59am UTC](https://forums.toadworld.com/t/automation-how-to-export-execute-script-results-to-file/30518/1 "2014-07-21T09:59:17Z")

</div>

Hello,

See screen shot below for an overview of my automation script. I am trying to export the result set of the "Execute\_1" activity, without re-running the same query in the "File\_1" Select to File activity.

In the sequence shown below, "Execute\_1" runs a query using a loop data set. The resulting set is run through an If statement, which checks whether the result set is empty or not (rowcount \> 0). If it is not empty, it will be exported to an Excel file. It would be nice if I could simply use the same result set for the Select to File activity, instead of re-running the same query. Is there a way to do this?

Thanks in advance,

David

 ![5824.1.png](https://global.discourse-cdn.com/quest/original/2X/9/94cea706ebd4ae871091505e6f76a749d891ad1c.png)
