Remove columns from Excel files using the Mapper Snap

This example demonstrates how to use the Mapper Snap to remove specific columns from an Excel file.


Mapper Snap Configuration Settings

Download this pipeline
  1. Configure the File Reader Snap
    Use the File Reader Snap to read the Excel file from SLDB that contains the columns you want to remove.

    File Reader Snap Configuration Settings

  2. Parse the file using the Excel Parser Snap
    Add the Excel Parser Snap to parse the Excel data. Preview the parsed data using the SL-data-preview icon to identify the unnecessary columns.

    Excel Parser Output

  3. Add a Mapper Snap to the pipeline
    Use the Mapper Snap to remove the unwanted columns from the dataset. For this example, remove the Discounts and Month Number columns.
  4. Configure the Mapper Snap

    In the Expression field, enter the following expression:

    $.filter((value, key) => !key.match("Discounts|Month Number"))
    Set the Target field to $ to preserve all other column names.
    Mapper Snap Configuration

    Validate the pipeline to confirm that the specified columns are removed.


    Mapper Snap Output

  5. Add a JSON Formatter Snap
    Use the JSON Formatter Snap to convert the output documents from the Mapper Snap into JSON format.
  6. Write the updated data using the File Writer Snap
    Use the File Writer Snap to write the final output into the SLDB as a JSON file.

    File Writer Snap Configuration

You can now view the updated file in the destination project in SnapLogic® Manager. The file excludes the Discounts and Month Number columns.


File saved in SnapLogic Manager