You can use a Derived Column transformation :
iif(columnName == null || trim(columnName) == '', null, columnName)
This will convert any empty or null column values to a consistent null value.
Then you can add a Filter transformation to remove empty columns :
length(trim(columnName)) > 0
If your file schema changes frequently, you can further enhance your solution to handle dynamic schemas using parameters and metadata-driven approaches in ADF :
- Parameterize Column Names:
- Use parameters in your Data Flow to handle column names dynamically.
- Pass the column names as parameters to the Derived Column and Filter transformations.
- Use Metadata Activity:
- Use the Metadata activity to get the schema of the source file.
- Pass this schema information as parameters to the Data Flow.