Example 1: Remove columns from Excel files with Mapper

This example pipeline demonstrates how to read an Excel file from the SLDB and remove columns that you do not need from the file.

  1. Configure the File Reader Snap to read the Excel file from which you want to remove specific columns.

  1. Parse the file with the Excel Parser Snap. You can preview the parsed data by clicking the   icon.

  1. You can view the columns you want to remove from the preview file. Add a Mapper Snap to the pipeline to remove the Discounts and Month Number columns.

  1. In the Expression field, enter the criteria (as shown below) to remove the Discounts and Month Name columns. 

  2. $.filter((value, key) => !key.match("Discounts|Month Number"))

  3. Enter $ in the Target field to indicate that you want to leave the other column names unchanged. Validate that the Discounts and Month Name columns are removed.

  1. To write the updated data into the SLDB as a JSON file, add a JSON Formatter Snap to the pipeline to convert the documents from the Mapper Snap into binary data.

  2. Then, add a File Writer Snap and configure it to write the input streaming data to the SLDB.

You can now view the saved file in the destination project in SnapLogic® Manager.

Download this pipeline

To successfully reuse pipelines:

  1. Download and import the pipeline into the SnapLogic platform.

  2. Configure Snap accounts, as applicable.

  3. Provide pipeline parameters, as applicable.

  File Modified

File ExcelParser_SkipColumns.slp

Dec 22, 2023 by Kalpana Malladi