# Add a Row Index, UUID, or Key Column to CSV

Add sequential row numbers, UUIDs, or composite key columns to CSV data online. Choose the delimiter, header handling, position, padding, prefix, and suffix.

## Run it

- **CLI:** `gizza tool csv-row-index-adder "name,city
Ada,London
Lin,Taipei"`
- **Web:** https://gizza.ai/tools/csv-row-index-adder/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/csv-row-index-adder/tool.json

## Inputs

- `data` — CSV data _(field)_
- `mode` — Generated value _(field)_
- `column_name` — New column name _(field)_
- `position` — Insert position _(field)_
- `reference_column` — Reference column (for before/after) _(field)_
- `has_header` — First row is a header _(field)_
- `start` — Start number _(field)_
- `step` — Step _(field)_
- `pad_width` — Zero-pad width _(field)_
- `prefix` — Prefix _(field)_
- `suffix` — Suffix _(field)_
- `columns` — Composite source columns _(field)_
- `separator` — Composite separator _(field)_
- `uuid_version` — UUID version _(field)_
- `uuid_format` — UUID format _(field)_
- `delimiter` — Delimiter _(field)_

## Output

- Updated CSV (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `data` — CSV data
- `mode` — Generated value
- `column_name` — New column name
- `position` — Insert position
- `reference_column` — Reference column (for before/after)
- `has_header` — First row is a header
- `start` — Start number
- `step` — Step
- `pad_width` — Zero-pad width
- `prefix` — Prefix
- `suffix` — Suffix
- `columns` — Composite source columns
- `separator` — Composite separator
- `uuid_version` — UUID version
- `uuid_format` — UUID format
- `delimiter` — Delimiter

Example: `https://gizza.ai/tools/csv-row-index-adder/?data=name%2Ccity%0AAda%2CLondon%0ALin%2CTaipei&mode=sequential&column_name=index&position=start&reference_column=city%20or%202&has_header=true&start=1&step=1&pad_width=0&prefix=INV-&suffix=-2026&columns=region%2Cdept%20or%201%2C2&separator=-&uuid_version=4&uuid_format=standard&delimiter=auto`

---

## About this tool

Add a generated key column to CSV or delimiter-separated data without leaving your browser. Use it for spreadsheet imports, test fixtures, database seeds, invoices, exports that need stable row IDs, or quick QA matrices.

The default mode adds a leading `index` column starting at 1:

```csv
name,city
Ada,London
Lin,Taipei
```

becomes:

```csv
index,name,city
1,Ada,London
2,Lin,Taipei
```

You can also build zero-padded values such as `INV-0001`, add one UUID per row, or create a composite key from existing columns like `region-dept`. Delimiters can be auto-detected or fixed to comma, tab, semicolon, or pipe, and quoted CSV fields are parsed with normal RFC 4180 double-quote rules.

### Limits and edge cases

- Input is capped at 5,000,000 bytes to keep browser runs responsive.
- `has_header` is on by default. Turn it off for headerless CSV so every row gets a generated value.
- `position = before` or `after` needs `reference_column`, which can be a header name or a 1-based column number.
- Composite mode needs `columns`, a comma-separated list of source columns by header name or 1-based number.
- UUID v4 values are random. UUID v7 values are time-ordered for the current run.
- The output preserves the chosen delimiter, but CSV quoting may be normalized by the CSV writer.

## FAQ

<details>
<summary>Can I start counting at zero instead of one?</summary>

Yes. Set **Start number** to `0`. You can also change **Step** to count by 5s, count down with a negative step, or combine it with **Zero-pad width** for IDs like `0000`, `0001`, `0002`.

</details>

<details>
<summary>How do I add IDs at the end of the CSV instead of the first column?</summary>

Set **Insert position** to `End`. To place the new column near an existing field, choose `Before reference column` or `After reference column`, then enter a header name such as `email` or a 1-based column number such as `3`.

</details>

<details>
<summary>What is composite mode for?</summary>

Composite mode joins values from existing columns into a business key. For example, with columns `region,dept`, rows like `EU,ops` and `US,eng` become keys `EU-ops` and `US-eng`. Change **Composite separator** if you need `EU::ops` or another format.

</details>

<details>
<summary>What UUID formats are available?</summary>

UUID mode can emit standard lowercase UUIDs with hyphens, uppercase UUIDs, compact UUIDs with no hyphens, `{braced}` UUIDs, or `urn:uuid:` strings. Choose v4 for random IDs or v7 for IDs that sort in row order for the current run.

</details>

## Related tools

- [Absolute value, sign, or negation for a whole column](https://gizza.ai/tools/absolute-value-transformer/): Paste a column of numbers and apply absolute value, sign extraction (-1/0/1), sign flipping, or force-negative to every value at once, with rounding and an audit table.
- [Adjacency Matrix Converter](https://gizza.ai/tools/adjacency-matrix-converter/): Convert a graph between edge list, adjacency matrix, and incidence matrix — directed or undirected, weighted or not. Free, private, runs in your browser.
- [Amazon Order Analyzer](https://gizza.ai/tools/amazon-order-analyzer/): Paste an Amazon order-history CSV export to summarize total spend by month, top items, and category breakdowns. Browser-only, private, with Markdown or JSON output.
- [ARFF Converter](https://gizza.ai/tools/arff-converter/): Convert Weka ARFF datasets to CSV and CSV tables back to ARFF locally — nominal attributes, numeric types, dates, sparse rows, missing values, and type rows.
- [Avro to JSON Converter](https://gizza.ai/tools/avro-to-json/): Decode Apache Avro Object Container Files (.avro / OCF) to JSON, NDJSON, or the embedded schema — no .avsc needed, free and private in your browser.
