Question

data extraction from excel file


Badge

Hello, Once a week we receive an excel file. You can see on the attached image how the excel file looks like when you open it with FME Inspector. I would like to create two new tables: one for the new units (row 6 till 9) and one for the new cells (row 14 till 23) including the headers (unit, unit title, south limit etc). How can I extract these rows using FME? The structure is the same every week (new units, then new cells) but the number of rows is variable.


3 replies

Badge +2

Wow, that's an eccentric structure. There are ways and means, but honestly the easiest by far would be to add named ranges in Excel - is that possible in this instance? If so, you can just read them in as separate tables using the same FME reader.

Userlevel 2
Badge +17

Hi @kat, I agree that using named ranges is an easy way, but if named range setting is not an option, I would use a global variable to split the source table into sub tables.

  1. Excel Reader: Read the spreadsheet using the column names (A, B, C, ...) as attribute names.
  2. TestFilter: Routes the feature to "StartSubTable" port if the "A" value starts with "New", otherwise to "Contents" port if the "A" has a value. Discard others.
  3. VariableSetter: Save the "A" value ("New Units", "New Cells", etc.) into a global variable.
  4. VariableRetriever: Retrieve the global variable and save it into a new attribute. e.g. "_subtable".
  5. TestFilter_2: Depending on the "_subtable" value, separate the feature flow into "New Units", "New Cells", and others. Discard others.
Badge

@takashi Thank you very much for the solution. It is working great. I've added an attribute creator before the variable retriever otherwise the 'new units' attribute value overwrites the attribute value for column A of the units (aa, bb, etc.). My next question is how can I delete the first row (it's row no 5 on my attached image) of the output for New Units TestFilter and use its values as the attribute name for the subsequent rows instead (for row no 6 - 9 on my attached image)? Thanks again.

Reply