The standard librarySlide 58 of 86
58xlsxThe standard library

Spreadsheets

hive.file.xlsx(path) and hive.file.ods(path) each read a whole workbook into a Result<Table[dyn], hive.file.TableError> — one Table per sheet, in document order, so an empty sheet is an empty Table, not a missing one. Sheets are reached by position; their names are not kept. Both readers are written without dependencies, and a reader is built in only when the program names it.

  • 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 the reader consults its number format and writes the date as 2026-07-25, 2026-07-25 18:00:00 or 18:00:00. An ods file stores real dates already.
  • xlsx leaves out a row with nothing in it, so after a blank second row the third row is table[1]. 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}"
	}
}