Skip to main content

Column Editing

Column editing commands modify the values inside existing columns in-place. Unlike Adding Columns (which adds new columns), these commands change the data directly.

Learning Focus

Use g= for bulk transformations with Python, ge for setting a literal value, f to fill nulls downward, and g* to regex replace values in-place. All are undoable with U.

Bulk Set with Python Expression (g=)​

Set the current column for all selected rows to the result of a Python expression.

g= expr # set current column for SELECTED rows to expression result (in-place)
gz= expr # set current column for CURRENT row only (in-place)
# Select all Engineering rows
|
# Enter: Engineering

# Uppercase their department
g=
# Enter: department.upper()

# Normalize region codes
# Select all rows with gs
gs
g=
# Enter: 'sg' if region == 'singapore' else region

Destructive but undoable with U.

Bulk Set with Literal Value (ge)​

Set the current column for all selected rows to a fixed text value.

ge text # set current column for selected rows to literal text
# Set all selected rows' 'status' column to 'inactive'
ge
# Enter: inactive

# Clear a column for selected rows
ge
# Enter: (leave blank)

Regex Replace In-Place (g*, gz*)​

Apply a regex replacement directly to existing values.

g* search<Tab>replace # modify current column for selected rows
gz* search<Tab>replace # modify ALL visible columns for selected rows
# Normalize status labels across selected rows
gs
g*
# Enter: active<Tab>ACTIVE

# Strip trailing whitespace from all columns for selected rows
gs
gz*
# Enter: \s+$<Tab>

For creating a NEW column with regex replace (keeping the original), see Splitting and Extracting.

Fill Nulls (f)​

Fill null cells in the current column with the non-null value from the row above.

f # fill null cells in current column from above
# A column has sporadic nulls:
# region: sg, null, null, kl, null, jp
# Move to 'region' column
f
# Result: sg, sg, sg, kl, kl, jp

Copy / Paste Columns (Y, gY, gP)​

Copy and paste entire columns. These operations work from the Columns Sheet.

Y # yank (copy) current column row (in Columns Sheet)
gY # yank all selected column rows (in Columns Sheet)
gP # paste previously yanked column(s) (in Columns Sheet)

See Columns Sheet Operations for details.

Cell Yank / Paste (zy, zp, gzp)​

Copy a single cell value, then either overwrite one cell or fill a column.

zy # yank (copy) current cell value
zp # paste into CURRENT cell (single-cell overwrite)
gzp # paste into current column for SELECTED rows

Single cell → single cell (no row selection needed):

# Source cell
zy

# Move to destination cell
zp

One cell → whole column (requires selected rows):

# Copy a tax rate from a cell
# Move to cell containing 0.07
zy

# Apply it to all rows in 'tax_rate' column
# Move to 'tax_rate' column
gs # select all rows
gzp

External Editor (g Ctrl+O)​

g Ctrl+O (press g, then Ctrl+O; longname sysedit-selected) opens the selected rows — with all their currently visible columns — as a temporary TSV file in your system $EDITOR. One row per line, one column per tab. Save and quit the editor to write the values back.

g Ctrl+O # edit selected rows (visible columns) in external editor
# 1. Select the rows with messy data
gs

# 2. Hide any columns you do not want to touch (optional)
- # hide current column

# 3. Launch the editor
g Ctrl+O
# "edit N rows as filetype:" → Enter to accept 'tsv'
# Edit the values in the temp TSV, then save and quit
Not a single-column editor

Despite appearances, g Ctrl+O edits every visible column of the selected rows, not only the current column. To edit just one column, hide the others first with - so it is the only visible column.

Requires selected rows

Use s to select one row or gs to select all rows. With nothing selected, g Ctrl+O reports no rows selected. To edit a single cell instead, use e → Ctrl+O (see Editing Cells).

note

^ is caret notation for the Ctrl key, so ^O means Ctrl+O. Plain o is a different command — it opens a file.

Quick Reference​

KeyActionDestructive?
g= exprSet column for selected rows to Python exprYes — undo with U
gz= exprSet current row only to Python exprYes — undo with U
ge textSet column for selected rows to literalYes — undo with U
fFill null cells from row aboveYes — undo with U
g* s<Tab>rRegex replace in-place (selected rows)Yes — undo with U
gz* s<Tab>rRegex replace in all visible columns (selected)Yes — undo with U
YYank column (Columns Sheet)No
gYYank selected columns (Columns Sheet)No
gPPaste yanked columns (Columns Sheet)Yes
zyYank current cell valueNo
zpPaste yanked value into current cellYes — undo with U
gzpPaste yanked value to column (selected rows)Yes — undo with U
g Ctrl+OEdit selected rows (all visible columns) in external $EDITORYes — undo with U

What's Next​