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.
Configure the File Reader Snap to read the Excel file from which you want to remove specific columns.
Parse the file with the Excel Parser Snap. You can preview the parsed data by clicking the icon.
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.
In the Expression field, enter the criteria (as shown below) to remove the Discounts and Month Name columns.
$.filter((value, key) => !key.match("Discounts|Month Number"))
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.
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.
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.
To successfully reuse pipelines:
Download and import the pipeline into the SnapLogic platform.
Configure Snap accounts, as applicable.
Provide pipeline parameters, as applicable.