Add Lag / Lead Column to Arrow Files Online
Add a LAG or LEAD column to Arrow 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.
How to add Lag / Lead Column to Arrow files
- Drop your file onto the upload area. The first 200 rows are shown.
- Choose a Direction. LAG takes the value from an earlier row and names the new column prev_value. LEAD takes it from a later row and names it next_value.
- Pick the Value column and the Offset (rows), which defaults to 1. Set Order by to your date or sequence column so "previous" means what you expect.
- Optionally set Partition by so the shift restarts for each group, and a Default value for rows that have no earlier or later row. Rename the output column if you like.
- Click Add LAG Column (or Add LEAD Column), check the preview, then download the file.
Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.
Worked example
A hydrologist has daily temperature readings from two weather stations in one file and wants the previous day's reading next to each day, without mixing the stations.
Input (Arrow)
Arrow IPC file (binary, columnar) — shown as a table with its schema
| station | reading_date | temp_c |
|---|---|---|
| WLG-01 | 2026-07-01 | 9.4 |
| AKL-02 | 2026-07-01 | 14.1 |
| WLG-01 | 2026-07-02 | 8.1 |
| AKL-02 | 2026-07-02 | 15.3 |
| WLG-01 | 2026-07-03 | 10.2 |
Schema: station VARCHAR, reading_date DATE, temp_c DOUBLE
Settings
- Direction: LAG
- Value column: temp_c
- Offset: 1
- Order by: reading_date
- Partition by: station
- Default: (blank, NULL)
- Output column name: prev_value
Result
| station | reading_date | temp_c | prev_value |
|---|---|---|---|
| WLG-01 | 2026-07-01 | 9.4 | NULL |
| WLG-01 | 2026-07-02 | 8.1 | 9.4 |
| WLG-01 | 2026-07-03 | 10.2 | 8.1 |
| AKL-02 | 2026-07-01 | 14.1 | NULL |
| AKL-02 | 2026-07-02 | 15.3 | 14.1 |
Each station's first day has no earlier reading, so prev_value is NULL. The shift never crosses from one station to the other because of Partition by. The rows come back grouped by station, because that is how the window is computed. Sort by reading_date afterwards if you need the original interleaved order. A day-on-day change is then temp_c minus prev_value.
Frequently Asked Questions
What is the difference between LAG and LEAD?
LAG reads from N rows earlier, for example yesterday's value. LEAD reads from N rows later, for example the next appointment date. Both add one new column and leave the original rows in place.
What does the Default value do?
It fills rows that have no row N positions away, such as the first row of each partition for LAG. The value you type is converted to the value column's type. A number works for a numeric column, but text that is not a number causes a conversion error.
Why is Order by optional?
Without it the shift follows the order rows were loaded, which is often file order but is not guaranteed. Set Order by whenever row order matters, which is almost always.
Related Tools
Add Calculated Column to CSV Files Online
Add a new column to CSV files computed from an arithmetic expression over existing columns. No formulas, no code — just point and click.
Calculate Date Difference in CSV Files Online
Calculate the difference between two date or timestamp columns in CSV files directly in your browser. Output in days, months, years, hours, minutes, or seconds — no upload required.
Filter CSV Files Online
Filter rows in CSV files by column value, directly in your browser. Your data stays on your device.
Add Lag / Lead Column to CSV Files Online
Add a LAG or LEAD column to CSV 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.
Add Lag / Lead Column to Excel Files Online
Add a LAG or LEAD column to Excel 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.
Add Lag / Lead Column to Parquet Files Online
Add a LAG or LEAD column to Parquet 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.
Add Lag / Lead Column to JSON Files Online
Add a LAG or LEAD column to JSON 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.
Arrow Viewer Online
View and inspect Arrow files directly in your browser. Browse rows, check column names and data types — no upload required, your data stays on your device.