Toad World® Forums

Default excel template file not being used when exporting

I have an excel template file Book.xltx saved in C:\Users\UserName\AppData\Roaming\Microsoft\Excel\XLSTART that contains several saved cell and table styles. When working in excel I’m able to create a new file and by default it uses this template so that i don’t have to recreate or copy a sheet containing these styles to a new file to use them.

However, when doing anything in TDP that would export to an excel file or excel instance it does not seem to use this same template. Using Export/Quick Export to an excel file or instance from a result set or Select to File in an Automation task results in some other excel default template book to be used. To get around this, I have to copy all of the data from the file that was created, Ctrl+N to create a new workbook and then paste the data in the new file.

Is there a setting or change I can make to point it to this workbook whenever it generates an excel file? I’d prefer not to have to add additional steps to all of my automation tasks to write the data to an existing blank file and then save the file as something else afterwards.

hi stuart.rauch,

Thank you for your post.

The reason why your template is automatically used when creating a new workbook (excel file) is that you use the excel application interface to do this for you. However when the data is exported by 3rd party applications (such as TDP) then certain app-interface features are ignored. Right now there isn’t any setting or feature that will take your template while exporting.

The workaround might be for you to add an additional step before the export step to simply copy the template from the folder you’ve mentioned in the export step’s input path and disable “overwrite file” with append data on the export step - in this case the formatting will be kept.

Martin