Skip to main content
Question

Overwrite existing data without overwriting the data and formatting in the rows above the existing data via FME Excel Writer


bec
Contributor
Forum|alt.badge.img+6
  • Contributor

I’m using an Excel Writer in FME Workbench 2024.2.  This is a workspace that will be run yearly and I have created an excel file to write to in the format that I need so that the end user gets the same output year after year.  I would like to use FME to clear any existing data in the excel file from row 5 on down, but still keep the data and formatting that exists in the rows above.  I tried Truncate Existing Sheet/Named Range: with my Start Row set to row 5, but cleared all of the existing data from the sheet and then wrote the new data starting at row 5.  In the below images, you can see what the sheet looks like before the writer is run, the writer parameters, and what the sheet looks like after the writer is run.  Is there a setting in the Writer Parameters that I need to change to ensure that the data and formatting in rows 1- 4 doesn’t get deleted?  Or is there another way that I need to approach this?  Any help would be greatly appreciated.  Thanks!

 

Sheet view before writer is run
Writer Parameters
Sheet view after writer is run

 

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

Truncate will remove all data from a table. So if you want to truncate, you’ll have to read and rewrite the first 5 rows.

As an alternative, you can use a FeatureWriter to delete specific rows, excluding the first 5 rows, and then another FeatureWriter to instert the new rows.


bec
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • May 29, 2025

I actually went a different route.  I figured out how to use a template within each writer for the 3 sheets that are being output to my final Excel file.  I set the first Writer for the Fatal Review to use a parameter so the user can set the Destination File location and name.  And within the Writer Parameters, the Overwrite Existing File is set to “Yes”.  The next two writers for the Buffer Review and CoC Review, are set to use whatever parameter the user input for the file name and destination from the Fatal Review Writer.  And within the Writer Parameters for those two the Overwrite Existing File is set to “No”.  This keeps the template file as is, and writes a new file, that follows the format and schema of the template file and starts inputting the data at row 5 from all three writers.  Overall this is a much better solution for my needs.  See below images.

 

Crashes Needing Review Workspace

 

Fatal Review Dataset and Template settings
​​​​​
Fatal Review Feature Type Parameters
​​​​​


 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings