Add Lag / Lead Column to TSV Files Online
Add a LAG or LEAD column to TSV files to shift any column forward or backward by N rows. See previous day's sales, next value in a sequence, or any time-shifted comparison — runs entirely in your browser.
Drop your .tsv file here
or click to browse — max 50 MB
About this tool
Add a LAG or LEAD column to a TSV file to shift any column forward or backward by N rows. LAG gives you the previous value — great for comparing today's sales to yesterday's. LEAD gives you the next value — useful for calculating time-to-next-event. Optionally order by a date column and partition by a group column so the window restarts cleanly per group. All processing runs locally in your browser — your data never leaves your device.
Frequently Asked Questions
What is the difference between LAG and LEAD in a TSV file?
LAG looks backward — the new column shows the value from N rows earlier (e.g. the previous day's sales). LEAD looks forward — it shows the value from N rows ahead (e.g. the next scheduled date). Boundary rows where no prior or next row exists get NULL (or your chosen default value).
Do I need an Order By column when using LAG or LEAD on a TSV file?
It is strongly recommended. Without an Order By column the window function operates on rows in their physical storage order, which may not be stable. Set Order By to your date, timestamp, or sequence column to get deterministic results.
What does the Partition By option do when adding a lag column to a TSV file?
Partition By restarts the LAG/LEAD window independently for each group. For example, if you partition by "product_id", each product's first row will be NULL rather than carrying a value from the previous product's last row.
What value fills boundary rows in the LAG/LEAD column of a TSV file?
By default, boundary rows — the first N rows for LAG, the last N rows for LEAD — get NULL. You can enter a custom default value in the Default field. The tool casts it to VARCHAR; if your column is numeric, you may want to use the SQL Query tool for type-precise defaults.
Is my data private?
Yes — completely. Your file is never uploaded to any server. Everything runs locally in your browser using WebAssembly — processing happens entirely inside your tab. Once you close the tab, nothing is retained.
What is the maximum file size?
The free limit is 50 MB. For larger files, performance depends on your device's available memory — most modern machines handle 500 MB to 1 GB comfortably.
Related Tools
Convert CSV to TSV Online
Convert CSV files to TSV format directly in your browser. No upload required — your data never leaves your device.
Convert Parquet to TSV Online
Convert Parquet files to TSV format directly in your browser. No upload required — your data never leaves your device.
Convert JSON to TSV Online
Convert JSON files to TSV format directly in your browser. No upload required — your data never leaves your device.
Convert NDJSON to TSV Online
Convert NDJSON files to TSV format directly in your browser. No upload required — your data never leaves your device.
Convert TSV to CSV Online
Convert TSV files to CSV format directly in your browser. No upload required — your data never leaves your device.