Skip to main content
Question

Dynamic writer excel: date is converted to number when using excelstyler

  • March 25, 2026
  • 3 replies
  • 56 views

arnovananrooij
Contributor
Forum|alt.badge.img+5

Hi,

I have a strange issue when writing to excel. I have a feature writer to excel in dynamic mode. To prevent numbers being converted to a scientific notation I added a Excel Styler where I set the custom numer format to 0. This works perfect.

The problem is that now my dates and datetimes are suddenly shown as number. When I change the cell format to date it shows the date, but I want it to directly show the date. When I remove the ExcelStyler, dates are shown as dates. Anyone any idea how to fix this?

I use FME 2023.2.5.

3 replies

hkingsbury
Celebrity
Forum|alt.badge.img+70
  • Celebrity
  • March 25, 2026

You should be able to set precisely which fields (attributes) the style applies to. By default, I believe it will apply the defined style to the whole row (feature) 


arnovananrooij
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • March 26, 2026

You should be able to set precisely which fields (attributes) the style applies to. By default, I believe it will apply the defined style to the whole row (feature) 

I read and write dynamic so I don't know the attributes in advance. I want al the date attributes to be styled like a date, all the timestamps as datetime and all the numbers in non-scientific.


debbiatsafe
Safer
Forum|alt.badge.img+22

Hello ​@arnovananrooij 

Dates in Excel are stored as integers representing the number of days since January 1, 1900 and time is stored as fractional decimals. So using the ExcelStyler to set the style for a row to a custom number format will affect dates and datetimes in the row as well.

As you’re dynamically writing using a schema feature, you can selective apply Excel formatting for any integer-type attributes by checking the value of attribute{}.fme_data_type on the schema feature instead of using an ExcelStyler to apply styling for the whole row. You would then need to create the Excel formatting attribute(s) and add the formatting attribute name(s) to the schema feature. 

For example, the attribute “anInteger” represents an integer value you want to apply the custom number format to. Create the formatting attribute anInteger.formatting on the data feature and set its value as version<semicolon>1<semicolon>number_format_string<semicolon># (displays number as integer or a blank if the cell is zero) or version<semicolon>1<semicolon>number_format_string<semicolon>0 (displays number an integer, rounding if necessary). Then add a corresponding list element to the schema list attribute. Doing this should only apply the custom number format to just the “anInteger” attribute.

Attached is an example workspace that demonstrates this approach and I hope it helps.