How do we get the "Filter Unmapped Elements" global function to work with Excel Schema? When
applied on a mapping, it seems to work fine on the data viewer. However,
when tested through a process flow, it doesn't seem to work.
The property to filter unmapped elements is for the mapper and not for the schema (in your case it is Excel Schema). The mapper output will only filter unmapped elements. But since your schema is defined for all the columns, those columns will be blank.
The output file which is created is according to the schema definition and if the columns are removed from definition then it will be removed at the target. This implementation is applicable for all the schema types.
An alternative solution - Creating an excel schema with maximum number of columns (in your case 30) and un-checking the Data Header flag. In the mapping activity create two clones at the Record level and at the first clone, define all related column names and at the second clone apply for-each from the source schema.