About
Use this tool to swap the positions of two columns in a delimited text. It's a handy way to rearrange data when the columns are not in the desired order. Specify the columns to swap by their column numbers. The tool will switch the positions of these columns, allowing you to reorganize your data with ease.
Basic Example
Swap the positions of the first and second columns in a delimited text.
Input
Column1 Column2 Column3
A B C
D E F
G H I
Output
Column2 Column1 Column3
B A C
E D F
H G I
Revert Changes
Made a mistake while swapping columns? You can easily undo the changes using the undo/redo function under the Edit button.
Related Tools
- Split Text - Split a text into individual columns or by a new line.
- Extract Column - Get a specific column from a delimited text.
- Concatenate Text - Combine or merge two lists/columns line by line.
Exchange two columns in a simple delimited list. Reorder values for a different layout without rewriting every row.
How to use
Paste the rows, set the exact delimiter, and enter both column numbers starting at 1. Swap and inspect rows with missing fields.
Example
Ada;London;UK becomes London;Ada;UK when columns 1 and 2 are swapped.
FAQ
Does it understand quoted fields?
No. Every literal delimiter separates a field. Use CSV tools when a field can contain the delimiter inside quotes.
A practical task
Verify the field positions on a header row before applying the swap. Exchanging name and city is safe only when every row uses the same separator structure. A missing field can shift the interpretation of later values.
Another useful question
Can I swap columns in only selected rows?
This operation applies to the supplied text. Prepare a subset separately if only some records need the exchange, and keep their original order documented.
Details for interpreting the result
| Detail | Explanation |
|---|---|
| Literal separators | A literal separator is an exact sequence of characters, including any spaces. A comma and a comma followed by a space are different separators. Match the source consistently before extracting or exchanging fields. |
| Column headers | Headers provide names for columns; they are not extra data values. Keep their order aligned with each row. When building objects, duplicate header names create ambiguity about which value belongs to a key. |
| Quoted CSV fields | In comma separated CSV, a field containing a comma, quote, or line break needs quotes around it. A quote inside that field is doubled. Splitting every comma by hand loses those field boundaries. |
| Empty and missing data | An empty string, a missing property, and null express different states in structured data. A flat table can merge some of those distinctions. Confirm how missing cells should be handled before converting records. |