Skip to content

Excel ↔ AGS4

Available in: Python · Node · CLI · Browser

Round-trip an AGS4 delivery through a spreadsheet — one sheet per group, with the headings / units / types as header rows — for hand-editing or sharing with non-AGS tools, then back to a compliant .ags.

lat excel examples/sample_site.ags site.xlsx   # → Excel workbook (summary on stderr)
lat excel site.xlsx round-tripped.ags          # → back to AGS4 (import)
lat read round-tripped.ags | head -3           # prove it: the first group codes
PROJ
TRAN
UNIT

lat excel <in> <out> picks the direction from the output extension — .xlsx exports (AGS4 → Excel), .ags imports (Excel → AGS4). Force it with --export / --import when the extension is ambiguous (the summary — sheets + rows — prints to stderr; here the round-trip is proved by reading a group back out). On import, --no-format-numeric leaves numeric-looking columns as text.

import laterite

laterite.to_excel("delivery.ags", "delivery.xlsx")      # one sheet per group
laterite.from_excel("delivery.xlsx", "round-tripped.ags")

to_excel / from_excel are the library face — pass groups=[...] to export a subset, or format_numeric_columns=False on import to keep cells as text. See the Python API.

See also: Read a group · Build from frames