This example demonstrates how to use the Mapper Snap to remove specific columns from
an Excel file.
Download this pipeline
-
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.
-
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.
-
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.
-
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.
Validate the pipeline to confirm that the specified columns are removed.
-
Add a JSON Formatter Snap
Use the
JSON Formatter Snap to convert the
output documents from the Mapper Snap into JSON format.
-
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.
You can now view the updated file in the destination project in SnapLogic® Manager. The file excludes the Discounts
and Month Number
columns.