Hub
Pricing About
WorkflowWorkflow

ForumQuestion0004 - Write Multiple CSV Files with a Loop

CsvExportLoopSave multiple files
carlosenrique84 profile image
Version1.0Latest, created on 
Nov 20, 2024 6:49 PM
Drag & drop
Like
Download workflow
Workflow preview

This workflow automates the process of exporting rows from a dataset into individual CSV files based on unique city names in the city column. The steps are as follows:

Read CSV File: The input dataset is loaded using the CSV Reader, which contains various rows with city names in one of the columns.

Group by City: The GroupBy node is used to group the dataset by the city column, generating a unique list of cities.

Start Loop: The Table Row to Variable Loop Start initiates a loop, where each iteration focuses on one city. This node creates variables from the unique city names.

Generate Dynamic File Paths: The Create File/Folder Variables node is used to generate a dynamic file path and filename based on the current city. Each file is named according to the city in the current loop iteration.

Filter Rows by City: A parallel branch with a Row Filter node is set up to filter rows that match the current city from the loop iteration. This node takes the entire dataset and filters it to only include rows for the city being processed in that iteration.

Write CSV Files: The filtered rows are then written to individual CSV files using the CSV Writer node. The file paths and names are dynamically generated from the city names.

End Loop: The Loop End node closes the loop after all cities have been processed and their respective files have been written.

This workflow efficiently exports a separate CSV file for each city, containing all the rows corresponding to that city from the input dataset.

External resources

  • Forum Post
Loading deploymentsLoading ad hoc jobs

Used extensions & nodes

Created with KNIME Analytics Platform version 5.3.3
  • Go to item
    KNIME Base nodesTrusted extension

    KNIME AG, Zurich, Switzerland

    Version 5.3.2

    knime

Legal

By using or downloading the workflow, you agree to our terms and conditions.

KNIME
Open for Innovation

KNIME AG
Talacker 50
8001 Zurich, Switzerland
  • Software
  • Getting started
  • Documentation
  • Courses + Certification
  • Solutions
  • KNIME Hub
  • KNIME Forum
  • Blog
  • Events
  • Partner
  • Developers
  • KNIME Home
  • Careers
  • Contact us
Download KNIME Analytics Platform Read more about KNIME Business Hub
© 2025 KNIME AG. All rights reserved.
  • Trademarks
  • Imprint
  • Privacy
  • Terms & Conditions
  • Data Processing Agreement
  • Credits