Skip to main content
Solved

Excel Writer - Multiple inputs - multiple sheets - different attributes per sheet

  • November 7, 2024
  • 3 replies
  • 261 views

deanhowell
Influencer
Forum|alt.badge.img+24

I have a FME workspace reader that reads in the various attributes of a particular workbench and want to send the results to an excel spreadsheet with one sheet per feature. Each feature has a different set of attributes and can’t figure out how to get each sheet to be only the attributes of that feature.

 

 

Do I just need to have a separate reader for each feature_type or is there a way to channel all features into a single reader?

Best answer by hkingsbury

You’re pretty close, you need to transition the process to a dynamic workspace as your schema changes across each feature type.

To do this you need two things, a schema feature, and your writer setup to accept that.

Thankfully, there is the SchemaScanner and this does most of the hardwork for you. You only need to make one change to it from its default state, that is setting group by to fme_feature_type
 

 

This then outputs a schema for each group of feature types, then connect both output ports to your excel writer.

In your writer, you will need to enable Dynamic Schema Definition and se the schema source to Schema From Schema Feature. In the User and Format Attributes tabs, make sure to unselect all rows and check that Attribute Definition is set to Dynamic.


The resulting workspace will look something like:
 

 

 

And your output Excel file with have a separate tab for each FeatureType with the correct attributes in each

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

aurorarosalie
Contributor
Forum|alt.badge.img+1

Yes, you just need to have a separate reader for each feature_type.


hkingsbury
Celebrity
Forum|alt.badge.img+65
  • Celebrity
  • Best Answer
  • November 7, 2024

You’re pretty close, you need to transition the process to a dynamic workspace as your schema changes across each feature type.

To do this you need two things, a schema feature, and your writer setup to accept that.

Thankfully, there is the SchemaScanner and this does most of the hardwork for you. You only need to make one change to it from its default state, that is setting group by to fme_feature_type
 

 

This then outputs a schema for each group of feature types, then connect both output ports to your excel writer.

In your writer, you will need to enable Dynamic Schema Definition and se the schema source to Schema From Schema Feature. In the User and Format Attributes tabs, make sure to unselect all rows and check that Attribute Definition is set to Dynamic.


The resulting workspace will look something like:
 

 

 

And your output Excel file with have a separate tab for each FeatureType with the correct attributes in each


deanhowell
Influencer
Forum|alt.badge.img+24
  • Author
  • Influencer
  • November 7, 2024

Thank you @aurorarosalie that is the path I went down to get a result but a big shout out to @hkingsbury for an elegant result.

To get it to work perfectly, I will need to do some additional attribute checks as Excel has some row and width restrictions.