> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.meetgail.com/platform/workflows/guides-and-recipes/recipes/loop-over-a-csv/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.meetgail.com/_mcp/server. # Loop Over a CSV > Parse a spreadsheet file into rows and run steps for every row. When you have a CSV file and want to do something for every row in it, such as adding each row as a contact or looking each one up, the pattern is always the same: parse the file into rows, then loop over those rows. ## Nodes involved * [Parse CSV](/platform/workflows/node-reference/files-and-documents/parse-csv) turns a `.csv` file into a list of rows. * [For Each](/platform/workflows/node-reference/logic-and-flow/for-each) runs a set of steps once for every row. ## How to build it ### Parse the file Add a Parse CSV step and point its **CSV file** field at the file you want to read. Turn the "first row is a header" option on so each column can be read by its name. ### Loop over the rows Add a For Each step and set its **Collection** to the parsed rows: ``` parse-csv.data.rows ``` ### Read each row inside the loop Inside the loop, the current row is available as `_each_.item`. Read a column by its header name: ``` _each_.item.email ``` Add whatever steps you need inside the loop and point their fields at the columns you care about. > **Note** > > For Each has a "collect results" option. Leave it off for large files; a long > list of gathered results can grow fast, and every pass is visible in the run > history regardless. ## Related #### [Parse CSV](/platform/workflows/node-reference/files-and-documents/parse-csv) Every option for reading a spreadsheet file. #### [For Each](/platform/workflows/node-reference/logic-and-flow/for-each) Every option for looping over a list. #### [Process a Daily CSV](/platform/workflows/guides-and-recipes/guides/process-a-daily-csv) A full guide that downloads a file and imports every row. > Documentation for Gail, the AI platform for financial services. Learn how to set up GailGPT and Gail Agent to automate customer communications for insurance, banking, and finance.