᠎᠎᠎          
51K

TSV Column Swapper

World's simplest tsv tool
Simple and free online TSV column swapper. Just paste a TSV table and choose two columns to move into each other's positions. You can select columns by position or header name, clean up comments and empty rows, and control how incomplete TSV rows are handled. Created by programmers from team Browserling.
We created a cloud browser! Browserling
Check out our project Browserling – anonymous cloud browser.
First Swap Column
Enter the position of the first column to swap. Use -1 for the last TSV column.
Enter the header name of the first column to swap.
Second Swap Column
Enter the position of the second column to swap. Use -1 for the last TSV column.
Enter the header name of the second column to swap.
Missing TSV Fields
Decide how rows with missing TSV fields should be handled.
Text used to fill missing TSV fields.
Comments and Empty Rows
Remove TSV rows that start with the marker entered below.
Marker used to identify comment rows, such as # or //.
Remove blank TSV rows.

What is a TSV Column Swapper?

learn more about this tool
This online tool changes the order of Tab Separated Values (TSV) data by swapping two columns. You can choose the first and second swap columns by their column positions, such as 1 and 4, or use negative positions, such as -1 for the last TSV column and -2 for the second column from the end. If your TSV table has a header row, you can select either column by its exact header name instead of a position. This makes it easy to move important fields into better positions, place related columns next to each other, or fix TSV data whose columns appear in the wrong order. If some rows have fewer fields than the columns you want to swap, the tool can leave those short rows unchanged, fill missing fields with empty values, or insert a custom field value such as "N/A", "null", "missing", or "x". For cleaner output, you can remove comment rows that start with a marker such as "#" or "//", and you can also remove empty rows. The result remains tab-delimited, so you can paste it back into spreadsheets, import it into databases, or use it in scripts that work with TSV data. Tsv-abulous!

TSV Column Swapper examples

Click to use
Swap a Quarter Column with the Last Column
In this example, we use a five-column TSV sales table. We swap column 2 with column -1, where -1 means the last TSV column. This moves the manager's name next to the month and sends the quarter values to the final column.
month quarter region units manager Jan Q1 North 120 Marta Feb Q1 West 98 Dion Mar Q1 East 143 Sana
month manager region units quarter Jan Marta North 120 Q1 Feb Dion West 98 Q1 Mar Sana East 143 Q1
Required options
These options will be used automatically if you select this example.
Enter the position of the first column to swap. Use -1 for the last TSV column.
Enter the header name of the first column to swap.
Enter the position of the second column to swap. Use -1 for the last TSV column.
Enter the header name of the second column to swap.
Decide how rows with missing TSV fields should be handled.
Text used to fill missing TSV fields.
Remove TSV rows that start with the marker entered below.
Marker used to identify comment rows, such as # or //.
Remove blank TSV rows.
Swap Ferry Status and Arrival Columns
This example swaps two columns by matching their header names. The ferry schedule has four columns, and the third data row is shorter than the others because the status value is missing. We swap the "status" and "arrival" headers and use a custom placeholder, so the short row receives the word "unknown" in the newly created status field.
dock arrival crew status Seaside 08:10 Blue On time Canal 08:35 Green Harbor 09:05 Gold Delayed
dock status crew arrival Seaside On time Blue 08:10 Canal unknown Green 08:35 Harbor Delayed Gold 09:05
Required options
These options will be used automatically if you select this example.
Enter the position of the first column to swap. Use -1 for the last TSV column.
Enter the header name of the first column to swap.
Enter the position of the second column to swap. Use -1 for the last TSV column.
Enter the header name of the second column to swap.
Decide how rows with missing TSV fields should be handled.
Text used to fill missing TSV fields.
Remove TSV rows that start with the marker entered below.
Marker used to identify comment rows, such as # or //.
Remove blank TSV rows.
Swap Task State and Owner Fields
In this example, we work with a compact three-column TSV task list. The input contains a comment row and a blank row, so the cleanup options remove both from the result. Then we swap columns 2 and 3, placing each task state before the owner's name.
task owner state // setup note Primer Jules ready Varnish Kira waiting Labels Oren done
task state owner Primer ready Jules Varnish waiting Kira Labels done Oren
Required options
These options will be used automatically if you select this example.
Enter the position of the first column to swap. Use -1 for the last TSV column.
Enter the header name of the first column to swap.
Enter the position of the second column to swap. Use -1 for the last TSV column.
Enter the header name of the second column to swap.
Decide how rows with missing TSV fields should be handled.
Text used to fill missing TSV fields.
Remove TSV rows that start with the marker entered below.
Marker used to identify comment rows, such as # or //.
Remove blank TSV rows.
Pro tips Master online tsv tools
You can pass input to this tool via ?input query argument and it will automatically compute output. Here's how to type it in your browser's address bar. Click to try!
https://onlinetsvtools.com/swap-tsv-columns?input=month%09quarter%09region%09units%09manager%0AJan%09Q1%09North%09120%09Marta%0AFeb%09Q1%09West%0998%09Dion%0AMar%09Q1%09East%09143%09Sana&use-column-number-from=true&column-number-from=2&use-column-name-from=false&column-name-from=quarter&use-column-number-to=true&column-number-to=-1&use-column-name-to=false&column-name-to=manager&incomplete-format=leave-incomplete&custom-value=NA&remove-comments=true&comment-character=%23&remove-empty-lines=true
All tsv tools
Didn't find the tool you were looking for? Let us know what tool we are missing and we'll build it!
Quickly change the TSV delimiter to a different symbol.
Quickly generate random TSV data.
Quickly extract selected columns from a TSV file.
Quickly delete selected columns in a TSV file.
Quickly add quotes around TSV columns.
Quickly remove quotes that surround TSV columns.
Quickly swap columns in a TSV file.
Quickly convert a TSV file to a JSON data structure.
Quickly convert a JSON data structure to TSV format.
Quickly convert a TSV file to XML markup.
Quickly convert XML markup to a TSV file.
Quickly convert a TSV file to YAML markup.
Quickly convert YAML data to a TSV file.
Quickly convert TSV data to CSV data.
Quickly convert CSV data to TSV data.
Quickly convert TSV data to nicely aligned text columns.
Quickly convert text columns to TSV columns.
Quickly convert TSV data to base64 encoding.
Quickly convert base64-encoded TSV data to TSV data.
Quickly convert a TSV file to URL-encoding.
Quickly convert a URL-encoded TSV file back to TSV.
Quickly prepend new columns at the start of a TSV file.
Quickly append new columns at the end of a TSV file.
Quickly insert new columns anywhere in a TSV file.
Quickly replace columns in a TSV file.
Quickly remove extra spaces around TSV columns.
Quickly truncate the contents of TSV cells to any length.
Quickly exchange TSV columns with rows.
Quickly exchange TSV rows with columns.
Quickly transpose a TSV file.
Coming soon These tsv tools are on the way
Validate TSV
Quickly check a TSV file for errors and report them.
Display TSV Statistics
Print information about a TSV file.
Calculate TSV Entropy
Find the complexity of a TSV file.
Show TSV Structure
Create an abstract drawing that shows the structure of a TSV.
View and Edit TSV
Show a TSV file in a neat editor and allow easy editing.
Convert TSV to Double-TSV
Convert a TSV file to a double-TSV file.
Convert Double-TSV to TSV
Convert a double-TSV file to a regular TSV file.
Convert TSV to HTML Table
Convert a Tab Separated Values file to an HTML table.
Convert HTML Table to TSV
Convert an HTML table to a Tab Separated Values file.
Convert TSV to Markdown
Convert a TSV file to a Markdown table.
Convert Markdown to TSV
Convert a Markdown table to a TSV file.
Convert TSV to PDF
Convert a Tab Separated Values file to a PDF document.
Convert PDF to TSV
Convert a PDF document to a Tab Separated Values file.
Convert TSV to Image
Draw Tab Separated Values as a table and output it as an image.
Convert Image to TSV
Extract data in an image and format it as a TSV file.
Convert TSV to Excel
Convert a Tab Separated Values file to an Excel spreadsheet.
Convert Excel to TSV
Convert an Excel file to a Tab Separated Values file.
Convert TSV to LaTeX
Convert a TSV file to LaTeX code that generates a table.
Convert TSV to ASCII Table
Convert a Tab Separated Values file to a neat ASCII table.
Convert ASCII Table to TSV
Convert an ASCII table to a Tab Separated Values file.
Convert TSV to SQL
Convert a Tab Separated Values file to an SQL query.
Convert TSV to SQLite
Convert a Tab Separated Values file to an SQLite database.
Convert SQLite to TSV
Export tables from an SQLite database as TSV files.
Convert TSV to PSV
Convert a TSV file to a PSV (Pipe Separated Values) file.
Convert PSV to TSV
Convert a PSV (Pipe Separated Values) file to a TSV file.
Convert TSV to HSV
Convert a TSV file to a HSV (Hash Separated Values) file.
Convert HSV to TSV
Convert a HSV (Hash Separated Values) file to a TSV file.
Convert TSV to SSV
Convert a TSV file to a SSV (Semicolon Separated Values) file.
Convert SSV to TSV
Convert a SSV (Semicolon Separated Values) file to a TSV file.
Convert TSV to 0SV
Convert a TSV file to a 0SV (Null Separated Values) file.
Convert 0SV to TSV
Convert a 0SV (Null Separated Values) file to a TSV file.
Split a TSV File
Create multiple TSV files from the given TSV file.
Merge TSV Files
Merge together two Tab Separated Values files.
Delete TSV Tabs
Remove tabs that go between TSV columns and merge all data.
Delete Empty TSV Columns
Remove columns that have no values in a TSV file.
Delete Empty TSV Rows
Remove rows that have no values in a TSV file.
Delete Empty TSV Lines
Remove lines in a TSV file that are blank.
Delete TSV Comments
Delete TSV lines that are comments.
Filter TSV Data
Filter rows and columns that match a pattern.
Find Values in TSV
Find certain values in TSV cells.
Find Duplicate TSV Rows
Extract repeated rows in a TSV file.
Merge Duplicate TSV Rows
Combine duplicate rows in a TSV file.
Deduplicate TSV Rows
Remove repeated rows from a TSV file.
Delete Duplicate TSV Rows
Delete duplicate rows from a TSV file.
Compress TSV
Minify a TSV file and remove extra spaces and indentation.
Compare Two TSV Files
Diff two TSV files and visually display the differences.
Rotate TSV Columns
Rotate TSV columns to the left or right.
Rotate TSV Rows
Rotate TSV rows up or down.
Cut a TSV File
Cut a fragment from a TSV file.
Slice a TSV File
Extract a slice (rows/columns/cells) of a TSV file.
Randomize TSV Values
Shuffle all data values in a TSV file.
Randomize TSV Columns
Shuffle the order of TSV columns.
Randomize TSV Rows
Shuffle the order of TSV rows.
Sort TSV Columns
Sort values in a TSV column.
Sort TSV Rows
Sort values in a TSV rows.
Count TSV Columns
Find how many columns there are in the given TSV data.
Count TSV Rows
Find how many rows there are in the given TSV data.
Count TSV Entries
Find how many total entries there are in a TSV file.
Color a TSV File
Add colors to TSV data for easy visual overview of the file.
Add Errors to TSV
Create random errors in a TSV file for fuzz testing.
Create a Custom TSV
Generate a custom TSV with n rows and m columns.
Open a TSV File
Open a TSV file directly in your browser.