Question

Highlight Cells in Existing Worksheet


Hi Everyone,

I have a workflow that takes a submitted Excel workbook and validates all of the input. The validations are not simple and often require checking data against databases, checking against other rows/tabs in the workbook etc. At the moment, I am writing out any issues/validation failures to a text file e.g. The value: 'XYZ' supplied on Tab: 'Tab1' in Row:5 Column:'C' is invalid for reason 'ABC'. I would like to highlight Cell C5 in red on the original file and send it back.

I don't want to create a new file or write all the data back out, just simply locate specific cells in the file I read in at the start and change their formatting. Is this possible? Thanks!

J


2 replies

Userlevel 2
Badge +17

Hi @granty555, I don't think FME can set format to existing Excel worksheet. However, it seems that the Excel writer can be used to overwrite only format of cells in a template, so this could be a workaround.

  1. Specify the source worksheet as a template for the Excel writer to create a new Excel file containing a copy of the original worksheet,
  2. read the original worksheet with format information (i.e. read "<attribute name>.formatting" attributes),
  3. and then overwrite only format of specific cells in the destination worksheet.

See also this demo: xlsxr2xlsxw-demo.fmwt (FME 2018.0.0.3)

Badge

Hi @granty555, I don't think FME can set format to existing Excel worksheet. However, it seems that the Excel writer can be used to overwrite only format of cells in a template, so this could be a workaround.

  1. Specify the source worksheet as a template for the Excel writer to create a new Excel file containing a copy of the original worksheet,
  2. read the original worksheet with format information (i.e. read "<attribute name>.formatting" attributes),
  3. and then overwrite only format of specific cells in the destination worksheet.

See also this demo: xlsxr2xlsxw-demo.fmwt (FME 2018.0.0.3)

Which versions of FME support this "formatting" attribute? e.g. Does 2016 support it? Thanks.

Reply