Staaarter

CSV Column Prepender

Adds a brand-new column as the first column of a CSV, with a header name you choose and a fill value repeated down every data row, shifting all existing columns one position to the right. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-29
By Staaarter Team
columnstructuralinsert

Overview

Introduction

Adding a new leading column to a CSV, an ID column, a source label, a batch tag, normally means opening a spreadsheet, inserting a column, and dragging a value down every row by hand. This tool does the same thing from pasted text in a couple of clicks.

It's built for the common case of tagging every row in an export with the same constant value in a new first column, before the data goes on to some other pipeline or import step.

What Is CSV Column Prepender?

A structural CSV tool that inserts one new column at position 0 of every row: your chosen header name in row 0, and your chosen fill value repeated in every data row below it.

It operates on the raw grid of cells rather than assuming any particular schema, so it works on any well-formed CSV regardless of column count or content.

How CSV Column Prepender Works

The input is parsed into a grid of rows and cells honoring RFC 4180 quoting, then padded so every row has the same width even if the source CSV had ragged rows.

A new cell is unshifted onto the front of every row, using the header name for row 0 and the fill value for every row after it, and the grid is re-serialized back into CSV text.

When To Use CSV Column Prepender

Use it when you need to tag every row of an export with the same constant, a source name, an import batch ID, a status flag, in a new first column.

It's also handy when downstream tooling expects a specific column (like an ID or category) to always be column 0, and your source data doesn't have one yet.

Features

Advantages

  • No spreadsheet program required; paste CSV text in, get CSV text out.
  • Correctly re-escapes any field that itself contains commas, quotes, or newlines.
  • Handles ragged input rows by padding them to a rectangle before inserting, so no column ever ends up misaligned.

Limitations

  • Every data row gets the exact same fill value; there's no per-row value support in this tool.
  • Only a comma delimiter is supported; tab- or semicolon-delimited files need converting first.

Column-insertion tools compared

Column-insertion tools compared
ToolInsertion point
CSV Column PrependerAlways index 0 (start)
CSV Column AppenderAlways the last index (end)
CSV Column InserterAny index you choose

Examples

Tagging rows with a constant source label

Input

name,amount
Ada,120
Alan,90

Output

source,name,amount
imported,Ada,120
imported,Alan,90

The new "source" column is inserted first, with "imported" repeated in every data row.

Best Practices & Notes

Best Practices

  • Pick a clear, unique header name so the new column doesn't collide with an existing one further down the row.
  • If different rows need different values, prepend a placeholder column here, then fill it in with CSV Column Replacer's newline-list mode.
  • Check the row count in the output matches your input, since a missing trailing newline in ragged CSVs can otherwise be easy to miss.

Developer Notes

Implemented as `[index === 0 ? headerName : fillValue, ...row]` over every padded row; the padding step (`padGridToRectangle`) runs first so a ragged source CSV never produces a jagged result after the insert.

CSV Column Prepender Use Cases

  • Adding a constant source or batch-ID column before merging several CSV exports together
  • Inserting a status or flag column that a downstream import script expects at position 0
  • Prepending a row-type label before combining data from multiple systems

Common Mistakes

  • Expecting each row to get a different value; this tool only ever repeats one fill value across all data rows.
  • Forgetting that all existing columns shift right by one, which can break any code that references columns by a hardcoded index.

Tips

  • Leave the fill value blank if you just want an empty placeholder column to fill in manually or with another tool later.
  • Pair with CSV Column Renamer if you insert now and decide on a better header name after seeing the output.

References

Frequently Asked Questions