Use CSV Files in iMacros: How Data Sources Work and Where They Break
How iMacros reads CSV files as a data source, what the import actually changes, and the delimiter, encoding and spreadsheet issues to check before relying on it.
iMacros can read a CSV file line by line and feed each column into a macro. It can also write extracted page data back out as comma-separated text. This review explains what that workflow does to your data, when it is a good fit, and where meaning or usability can be lost between the spreadsheet, the macro and the page. No product-specific test results, version numbers or measurements were available for this article. Treat the behavior described here as general, documented iMacros practice, and confirm it against the edition you use: browser extension, desktop or scripting interface.
Is a CSV data source suitable for your task?
A CSV data source suits repetitive form filling or lookups where every run uses the same steps and only the values change. Examples include submitting a list of records, searching a site for each entry in a list, or testing a form with many inputs. The main benefit is separation. The macro holds the steps and the file holds the data, so you can edit, extend or replace the data without touching the macro.
The main tradeoff is fragility at the file boundary. iMacros matches values to columns by position. A reordered column, an extra delimiter inside an unquoted value, or a file saved in an unexpected encoding can push the wrong text into the wrong field without any obvious error.
A plain text file or a hard-coded value is the better choice when you have only one value or a handful of fixed values. A scripting interface is better when the input needs conditional logic, deduplication or validation that a flat line-by-line read cannot express.
What reading a CSV file actually changes
Using a CSV file does not transform the characters in your data. Nothing is reversed, restyled or substituted. The change is structural. Each line of the file becomes one record, and each delimited field in that line becomes a numbered column variable. The text inside a field is passed to the page as stored. That holds as long as it was parsed correctly and the encoding was read as intended.
The core commands are listed below. Older documentation also mentions a setting that declares the number of columns. Some editions require it and others ignore it, so check your version.
- SET !DATASOURCE names the CSV file. By default iMacros looks for it in its Datasources folder.
- SET !DATASOURCE_LINE selects which line of the file to read. It is usually tied to the loop counter.
- {{!COL1}}, {{!COL2}} and so on insert the value of the first, second and later columns of the current line.
- {{!LOOP}} is the current loop number. It increases each time the macro is played in loop mode.
- SET !DATASOURCE_DELIMITER, where supported, changes the field separator from a comma. This allows semicolon- or tab-separated files.
In the minimal example below, the file has a header row on line 1. Starting the loop at 2 skips that header. The TAG lines are placeholders: replace the form and field attributes with the ones recorded from your own page.
SET !DATASOURCE contacts.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:signup ATTR=NAME:fullname CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:signup ATTR=NAME:email CONTENT={{!COL2}}
TAG POS=1 TYPE=BUTTON FORM=NAME:signup ATTR=TXT:Submit
Run the macro with the loop play option, not a single play, so that {{!LOOP}} advances and each run reads the next line. Set the loop maximum to the number of data lines. If the loop runs past the last line, the macro stops with an error rather than reusing data. That behavior is useful for spotting a miscount.
The reverse direction works on the same principle. Values captured with EXTRACT are collected into the !EXTRACT variable. SAVEAS TYPE=EXTRACT then appends them to a file as one comma-separated line per run. The extracted text itself is not reformatted, but any commas, quotes or line breaks it contains affect how the output file opens elsewhere.
Will the data stay intact after editing, copying or sharing the file?
Most problems with CSV in iMacros come from what happens to the file outside iMacros, not from the macro itself. Check the following points before trusting a run.
- Delimiters inside values. A field that contains a comma, such as an address or a name with a suffix, must be wrapped in double quotes. Otherwise it splits into extra columns. Test a quoted field in your edition rather than assuming it is handled.
- Regional spreadsheet settings. In some locales, spreadsheet programs save CSV with semicolons instead of commas. A macro expecting commas will then read each whole line as one column. Either set the delimiter in the macro, where supported, or re-save the file with commas.
- Encoding. Accented letters and non-Latin scripts can turn into garbled characters if the file's encoding differs from what iMacros expects. UTF-8 is the usual choice. Confirm that your edition reads it correctly, including whether a byte order mark at the start of the file causes problems in the first column.
- Leading zeros and long numbers. Spreadsheets may strip leading zeros from postal codes or IDs, or convert long numbers to scientific notation, before the file is saved. The CSV then carries the altered value, and iMacros submits it as written.
- Header rows and blank lines. A header row is read as data unless the loop starts after it. A trailing blank line may produce an empty final run.
- Line breaks inside fields. Multi-line values, such as text-area content, are a common source of misaligned rows. Verify them with a small test file first.
Because the data is stored as ordinary text, a CSV file stays readable by people, by search and by assistive technology such as screen readers. You can open it in any text editor. That is a real advantage over binary spreadsheet formats when you need to audit exactly what a macro will submit. The practical limit is that a spreadsheet program presents the data in its own way. It may silently reinterpret dates, numbers and delimiters when the file is opened and saved again.
Choosing between CSV, TSV and plain text
| Format | Best fit | Main risk |
| CSV (comma-separated) | Most tabular input and extracted output; widely accepted by other tools | Commas inside values need quoting; locale may swap in semicolons |
| TSV or other custom delimiter | Data with frequent commas, such as addresses or prose | Requires delimiter support in your iMacros edition; tabs are invisible when editing |
| Plain text or hard-coded values | One value or a short fixed set | Does not scale; data and steps are mixed together |
Gaps in this review
No version-specific documentation, changelogs or test runs were supplied. This review therefore cannot confirm the following for any particular release:
exactly which iMacros editions support a custom delimiter;
how quoted fields and embedded line breaks are parsed;
how file encodings and byte order marks are handled;
where the default Datasources folder is located on your system.
It also makes no claims about licensing, pricing or data handling. Before running a CSV-driven macro against live forms, check your edition's documentation. Then do a dry run with a three- or four-line file that includes a quoted comma, an accented character and a leading zero.