DocsFileRead Text File

Read a text file into a variable in RunMacro

Desktop ModeBrowser ModeRunMacro 3.5+

Read Text File loads a file's full content into a variable, with a chosen encoding and read-size cap.

Dialog & quick setup

RunMacro Read Text File command configuration dialog showing parameter fields
Configuration dialog and parameter fields for the Read Text File command in RunMacro.
  1. Add a File › Read Text File command.
  2. Enter the file path.
  3. (Optional) Choose the encoding and error handling.
  4. (Optional) Set a size cap and rename the content variable. Save.

Options reference

File path

The text file to read. Supports variables; matches Unicode names if needed.

Encoding

Default utf-8. Change it if the file uses another encoding.

Errors

strict (error), replace (substitute bad chars), or ignore (drop them).

Max bytes

Blocks reading a file larger than this (default ~10MB). 0 = no limit.

Content variable / Path variable

Variable for the content (default file_content) and for the read path (last_read_path).

Modes & when to use

Desktop Mode

Operates on the local file system.

Browser Mode

Best for

  • Load a config/template from a text file.
  • Read input data to process.
  • Get file content to compare or extract from.

Use an alternative when

  • Tabular data (CSV/Excel) to loop row by row — use the Data Source.
Before you run
  • The file exists and is readable.

Example workflow

Example: load a list from a file

  1. Read Text File: path list.txt, content variable lines.
  2. Use {lines} in later steps (e.g. split lines to loop).
Expected result: The content variable holds the file text; the path variable holds the read file.

Tips & limitations

If the file uses an odd encoding, set Errors = replace to avoid stopping mid-run.
  • Files over the size cap are refused.

Applies to RunMacro 3.5+ · Desktop Mode & Browser Mode · Windows 10/11

RunMacro robot

Robots do the work. Your time is yours.

Create a robot in minutes, no coding needed. Reliable execution, remote management, transparent costs — and you always stay in control.