Toad World® Forums

TDP 3.8: Export Template error "Cannot access a closed file. Export is cancelled."



I have an export template which runs a query and outputs the results as a text file. This has run successfully in the past, however it has recently been giving me errors.

The first error:

When I click OK, it appears that it does begin the export, however stops after 5000 rows. I validated that the export file was created and does contain 5000 rows.

I then tried running the query and from results window Export–>Export Wizard–> Delimited Text and was able to save the file manuallyu.

Any ideas what could be causing this error and how to resolve?


i have seen this when scripts are run closely together and Excel does not have enough time to close the file. We added wait code in later versions. Can you try the Beta? Or you could also try a delete of the file prior to the export to force clean up. Also, schedule scripts apart from each other.


This exact issue just started for me in v4.3.

Exporting to delimited text.

Export *.txp file used to work fine.

Now fails with "Cannot access a closed file."

File is created with 5000 rows.

I can export all rows manually by running query then using export wizard.

This is the first job in my automation script. I don't see anything in your (Debbie) previous reply that I could try.

Any update?


The original post was regarding version 3.8. We have not seen this issue with our automation testing. So we must be missing something. Do you mind opening a support ticket so I get have support assist in gather all the details we need to reproduce the error?


Done. SR Number:4486421. thanks.