The standard library
Slide 57 of 85
57xlsxThe standard library

Spreadsheets

hive.file.xlsx(path) and hive.file.ods(path) each read a whole workbook and answer with a Result<Table[dyn], hive.file.TableError> — one Table per sheet, in document order, so an empty sheet is an empty Table rather than a missing one. Sheets are reached by position: their names are not kept. Both readers are written without dependencies, and naming one is what brings it into the build.

  • Every row is padded to the widest row in its sheet, so a cell in range of the first row is in range of every row.
  • A cell arrives as the file stores it — numbers, booleans and a formula's last result untouched — with one exception: xlsx keeps a date as a day count, so its number format is consulted and a date comes out as 2026-07-25, 2026-07-25 18:00:00 or 18:00:00. An ods stores real dates already.
  • An xlsx file leaves out a row with nothing in it, so a blank second row makes the third one table[1]; an ods keeps blank rows between filled ones.
proc main(): void {
	sheets := hive.file.xlsx("./ledger.xlsx")
	if sheets is Result.Ok(tables) {
		if tables bounds 0 {
			echo len(tables[0])
		}
	} else if sheets is Result.Error(err) {
		echo "no workbook yet: {err.message}"
	}
}