Description


The Excel writer does not yet have a setting which allows you to delete an existing file prior to writing to the file. This can be a problem as features are inserted into an existing file possibly resulting in duplicate records. The only way to get around this is to delete the file first either via a Startup script or by using a DOS command in a batch file.

To use a TCL startup script enter the string

if { [file exists $FME_MacroValues(DestDataset_XLS_ADO_3)] == 1 } { 
    puts [concat Deleting $FME_MacroValues(DestDataset_XLS_ADO_3)] 
    file delete -force $FME_MacroValues(DestDataset_XLS_ADO_3) 
} else { 
    puts [concat $FME_MacroValues(DestDataset_XLS_ADO_3) does not exist] 
} 
 

To use a Python startup script enter the string - which will check if the file actually exists and delete it if it does.

import os
if os.path.exists('//spock.test.internal/rt/Folder/existingfilename.xls'):
    os.remove('//spock.test.internal/rt/Folder/existingfilename.xls')

Note: Now in FME 2013 betas there is an option on the XLS_ADO writer to overwrite the existing file.