Importing data from an Excel file containing empty rows

When importing an Excel file with empty rows, these rows are included in the import set, leading to garbage data being created in the target table as a result of transformation.

As a workaround to skip empty rows from the Excel file, you can add a related transform script [sys_transform_script] of type “onBefore/Before Transformation” (see screenshot) to the transformation map [sys_transform_map] with the following content:

(function runTransformScript(source, map, log, target /undefined onStart/) {
const impAttributes = Object.keys(source.getAttributes()).filter(attr => attr.startsWith('imp_'));

if (impAttributes.every(attr => !source.getValue(attr))) {
    ignore = true;
    status_message = 'Excel Row is empty';
}

})(source, map, log, target);

3 Likes