Unify Logo Footer.svg
Unify Automations
Logo
Text Reader

Text Reader

The Text Reader Node reads a text file line by line, yielding each line to the steps inside the iterator block without loading the entire file into memory at once.

Overview

The Text Reader Node is an iterator node that walks a text file one line at a time, delivering each line to the loop body as it goes. Use it to process log files, delimited text, or any line-oriented content where you want to handle one line at a time rather than pulling the whole file into a variable. Because it iterates rather than reads-all, it stays efficient even on large files — memory use stays flat regardless of how many lines the file contains.

Pair the Text Reader with the loop body to apply transforms, filters, or writes to each line as it arrives. Use the Is First and Is Last flags exposed by the loop to run setup or teardown logic — opening a target file, flushing a buffer — without adding conditional branches to every pass.

Reading Text Files

The node iterates a text file from a specified starting line, exposing one line at a time to the steps inside the loop body. Each pass delivers the current line of text together with metadata about its position in the file.

Inputs

Field

Description

File

The text file to iterate. Read as UTF-8 by default.

Starting Line

The line number to begin reading from. Counted from 1 — line 1 is the first line in the file. Set this to skip header rows or resume from a checkpoint.

Loop Outputs

The following values are available inside the loop body on each pass:

Output

Description

Line

The current line of text from the file.

Index

The zero-based position of the current line within the iteration. The first line yielded has index 0, regardless of the Starting Line setting.

Is First

True on the first iteration pass. Use this to run setup logic once — for example, opening a target file or initialising a counter.

Is Last

True on the final iteration pass. Use this to flush a buffer or finalise output after the last line has been processed.

Notes

Keep the following in mind when using the Text Reader Node.

  • Files are read as UTF-8 by default.

  • Starting Line is counted from 1. Line 1 is the first line in the file. Use it to skip a known number of header or already-processed lines.

  • Index is zero-based and counts from the first line yielded by the node, not from the beginning of the file. If Starting Line is set to 5, the first yielded line has index 0.

  • Use the Is First and Is Last flags to run setup or teardown logic exactly once without conditional branches on every loop pass.

  • The node iterates rather than reads-all — memory use stays flat regardless of file size. Prefer this node over reading an entire file into a variable for any file large enough to matter.

  • For structured line-delimited data (one JSON object per line), consider the JSON Node instead — it parses each line as a record and exposes typed fields rather than raw text.

FAQs

What does Index represent and how is it counted?

Index is a zero-based counter that tracks the node's position within the current iteration — not the line number in the original file. The first line the node yields has index 0. If you set Starting Line to 10, the first yielded line still has index 0. Use Starting Line when you need to skip lines; use Index when you need to count how many lines you have processed so far in this run.

How do I skip a header row?

Set Starting Line to 2. The node will begin iterating from line 2, skipping line 1 entirely. If the file has multiple header rows, set the value accordingly — for example, set it to 4 to skip the first three rows.

Does the Text Reader load the whole file into memory?

No. The node walks one line at a time, so memory use stays flat regardless of how many lines the file contains. It is safe to use on large files — logs with millions of entries, large exports — without worrying about memory exhaustion.

Should I use the Text Reader or the JSON Node for JSONL files?

Use the JSON Node for JSONL. It parses each line as a structured record and exposes the object's fields directly, which makes downstream steps much simpler. The Text Reader yields raw text strings — appropriate for unstructured or custom-delimited content where you want full control over parsing.