I am reading an Excel file online where the sheet name and attribute names sometimes change. I therefore need to read the sheet and attribute names dynamically. I can get the schema but I haven't figured out how to read in the data using a dynamic schema. ("Scan Schema in Dynamic Workflow" doesn't appear to work for the Excel Reader.) I figured out how to use a FeatureReader to get the sheet name dynamically using fme_feature_type_name and then pass it to a second Feature Reader but I haven't figured out how to get the attribute names dynamically and then pass them along to the second FeatureReader so I can read in the data. Or is there another way?
Hello @aaron ,
You may need to use a Schema reader to read the sheet names and then a FeatureReader to read all the features in all the sheets. They will be output in a single (Generic) port though.
You need to expose the fme_feature_type attribute in the FeatureReader and then use it to separate records from different sheets in the writer.
I attached a sample workspace you may inspire from.
Hello @aaron ,
You may need to use a Schema reader to read the sheet names and then a FeatureReader to read all the features in all the sheets. They will be output in a single (Generic) port though.
You need to expose the fme_feature_type attribute in the FeatureReader and then use it to separate records from different sheets in the writer.
I attached a sample workspace you may inspire from.
Hi @germang, thanks for the example workspace. It dynamically exposes the sheet name, which I need, but I also need to dynamically expose the attribute names from the Excel spreadsheet so I can read in the data and then do some processing before creating output. I don't know what the attribute names will be called ahead of time. It's my experience that attribute names have to be exposed beforehand in the Generic port in the FeatureReader. I don't see how to read them in dynamically.
I can get the attribute names from the Schema port but I don't know how to pass them into a parameter which could then be read by a second Feature Reader. Do you have an idea how that might work?
Hi,
Attribute names can be obtained in the Schema port or in the Schema reader as you mentioned, unfortunately, I don't know a way to expose those dynamically in an Excel reader.