API reference: files, cells and tables

Files and sheets

OpenDocumentSpreadsheets.readods — Function
readods(source) -> ODSFile

Read an OpenDocument spreadsheet from a file path or an IO: openods with the cache enabled. Each sheet is parsed the first time it is used.

ods = readods("budget.ods")
sheetnames(ods)           # ["Income", "Costs"]
sh = ods["Costs"]         # or ods[2]
sh["B3"]                  # 100.0
sh["A1:C3"]               # a 3×3 matrix
source
OpenDocumentSpreadsheets.openods — Function
openods(source; mode="r", enable_cache=true) -> ODSFile
openods(f::Function, source; mode="r", enable_cache=true)

Open an OpenDocument spreadsheet (.ods, .fods or .ots, detected from the content) from a file path or an IO. The do-block form passes the file to f and returns what f returns.

content.xml is read once, and the sheets are located without being parsed.

  • enable_cache=true: a sheet is parsed into memory the first time one of its cells is read; later reads use that copy.
  • enable_cache=false: every read scans the sheet again, keeping nothing, and stops after the last row it needs. Use it with eachrow to stream a large sheet.

Modes:

  • "r": read only.
  • "rw": read and edit; save with saveods or writeods. Saving patches the original file: everything OpenDocumentSpreadsheets does not edit is kept as it was.
  • "w": start a new, empty spreadsheet (with one sheet, Sheet1) that will be written to source; an existing file there is not read.

Writing modes need enable_cache=true. With the do-block form, a file opened for writing is saved to source after f returns (not if f throws).

openods("budget.ods"; mode = "rw") do ods   # saved when the block ends
    ods["Costs"]["C2"] = "Paid"
end

ods = openods("budget.ods"; mode = "rw")    # or saved by hand
ods["Costs"]["C3"] = "Paid"
saveods(ods)

See also readods, newods.

source
OpenDocumentSpreadsheets.newods — Function
newods(sheetname="") -> ODSFile

A new, empty spreadsheet with one sheet (Sheet1, or sheetname), open for writing. Write it with writeods.

ods = newods("Results")
sh = ods["Results"]
sh["A1:B1"] = ["Item" "Total"]
sh["A2"] = "Paper"; sh["B2"] = 12.5
writeods("results.ods", ods; overwrite = true)
source
OpenDocumentSpreadsheets.writeods — Function
writeods(dest, ods::ODSFile; overwrite=false, version="1.4") -> path or nothing

Write ods to dest, a file path or an IO.

  • The format follows the extension of a path: .ods, .ots (a template) or .fods (flat XML). Writing to an IO keeps the format the file was read in (.ods for a new one).
  • A file that was read is written by patching it: what OpenDocumentSpreadsheets does not edit is kept exactly as it was. It can be written as a template or a document, and zipped or flat: an .ods saved as .fods is one XML document, with its pictures and charts inside it, as LibreOffice's Save As ▸ Flat XML ODF Spreadsheet writes it, and a .fods can be saved as .ods again. Its links to files beside it still point at them. What a flat file has no place for is left out, as LibreOffice leaves it out: the thumbnail, and a dialog, a toolbar, a signature or a part another program added, which a warning names.
  • A new file is written in ODF 1.4, or 1.3 with version="1.3".
  • display_text=false leaves out the display text (text:p) of the number, date, time and boolean cells that OpenDocumentSpreadsheets writes; readers recompute it from the value. Files are then smaller (about half, for numeric data) and faster to write.
  • An existing file at dest is only replaced with overwrite=true.

A path becomes the file's new source (for saveods). Returns the absolute path, or nothing for an IO.

ods = openods("budget.ods"; mode = "rw")
ods["Income"]["D1"] = "Checked"
writeods("budget-checked.ods", ods)      # a copy: budget.ods is unchanged
writeods("budget.fods", ods)             # flat XML, to keep in version control

writeods("template.ots", newods("Sheet1"); overwrite = true)   # a template
source
OpenDocumentSpreadsheets.saveods — Function
saveods(ods::ODSFile)

Save ods back to where it was opened from: its file, or the IO it was read from (which must be writable and seekable; its content is replaced). A file made with newods has nowhere to go: use writeods.

source
OpenDocumentSpreadsheets.ODSFile — Type
ODSFile

An opened spreadsheet, as openods and readods return it. Index it by sheet name or number (ods["Sheet1"], ods[1]), or with a sheet-qualified reference or a defined name (ods["Sheet1.A1:B2"], ods["Sheet1!A1"], ods["myrange"]).

source
OpenDocumentSpreadsheets.hassheet — Function
hassheet(ods::ODSFile, sheetname) -> Bool

Whether the file has a sheet named sheetname. Names match without regard to case, as in LibreOffice, which does not allow two sheets whose names differ only in case.

source
OpenDocumentSpreadsheets.addsheet! — Function
addsheet!(ods::ODSFile, name="") -> Worksheet

Add an empty sheet at the end. Without a name, it is called SheetN (the first free N).

ods = newods("Income")
costs = addsheet!(ods, "Costs")
costs["A1"] = "Month"
sheetnames(ods)           # ["Income", "Costs"]
source
addsheet!(s::StreamWriter, name=""; columns=nothing, column_widths=nothing, column_formats=nothing,
          as_table=false, table_name="", table_style=nothing) -> StreamSheet
addsheet!(s::StreamWriter, name, table; column_widths, column_formats, as_table, table_name, table_style) -> StreamSheet

Start the next sheet of a streamed file, finishing the one before. columns writes a header row; a Tables.jl table writes its header and all its rows. column_widths and column_formats set the columns' widths and the number formats of the rows written after the header, as in writetable!. as_table=true makes the sheet's rows a table, named table_name ("": the first free TableN), as writetable! does; it needs columns.

source
OpenDocumentSpreadsheets.ODSError — Type
ODSError

The exception OpenDocumentSpreadsheets throws for its own errors: an invalid reference, a missing sheet, a file that is not an OpenDocument spreadsheet, and so on. e isa ODSError tells these apart from other errors, and e.msg is the message.

source

Reading cells

OpenDocumentSpreadsheets.getdata — Function
getdata(sheet, ref)
getdata(sheet, row, column)
getdata(sheet)

Values from a worksheet: a scalar for a single cell, a Matrix{Any} for a rectangular range, or a vector of matrices for a list of ranges. Empty cells, empty strings and errors read as missing.

ref is a cell or range ("A1", "A1:C4", "A:B", "1:4", "A1:A4,C1"), one with its sheet named ("Sheet1.A1:C4"; "Sheet1!A1:C4" also works), or a named range. Rows and columns can also be integers, unit ranges, step ranges, vectors or :. For whole columns or rows, the other extent is the sheet's get_dimension.

Indexing a Worksheet calls getdata: sheet["A1"], sheet[1:3, 2], sheet[:].

The value types are described in Cell: Int64 or Float64 for numbers, String, Bool, Date or DateTime, and Time (or a CompoundPeriod for 24 hours or more).

source
OpenDocumentSpreadsheets.readdata — Function
readdata(source, sheet, ref)
readdata(source, sheetref)

Open source (a path or an IO) without the cache, and return getdata of ref on sheet (a name or a number), or of a sheet-qualified reference such as "Sheet1.A1:B3" ("Sheet1!A1:B3" also works).

readdata("budget.ods", "Costs", "B2:B4")   # a 3×1 matrix: 50.0, 100.0, 150.0
readdata("budget.ods", "Costs.B2")         # 50.0
source
OpenDocumentSpreadsheets.get_dimension — Function
get_dimension(ws::Worksheet; allow_load=true) -> CellRange

The smallest range holding every cell with a value or formula. ODS files do not record it, so it is computed from the sheet (the cache, or a scan without the cache). An empty sheet gives A1:A1 (shown as empty when the sheet or its file is displayed). With allow_load=false, an unread sheet gives A1:A1 without being read.

source
OpenDocumentSpreadsheets.Cell — Type
Cell

A cell read from a worksheet. Fields:

  • ref::CellRef: its position
  • datatype::Symbol: the ODF value type: :float, :percentage, :currency, :date, :time, :boolean, :string, :error, or :empty (a formula with no result, or a covered cell)
  • value: its value, as getdata returns it
  • formula: the stored formula ("of:=[.A1]*3"), or nothing; getFormula gives it in LibreOffice's notation
  • style::String: the name of its effective cell style
  • currency: the currency code of a currency cell ("GBP"), else nothing
  • error: the displayed text of an error result ("#DIV/0!", "Err:502"), else nothing
  • colspan, rowspan: the size of a merge whose top-left cell this is (1 otherwise)
  • covered::Bool: whether the cell is hidden by a merge
source
OpenDocumentSpreadsheets.iserror — Function
iserror(sheet, ref)
iserror(sheet, row, col)

Whether a cell holds an error result (#DIV/0!, #N/A, Err:502, ...), which getdata reads as missing. For a range, a matrix of Bools (a vector of them for a list of ranges). The ODF file marks errors with calcext:value-type="error".

source
iserror(r::ChartRef) -> Vector{Bool}
iserror(r::ChartRef, i) -> Bool
geterror(r::ChartRef) -> Vector{String}
geterror(r::ChartRef, i) -> String

Whether each value of a chart reference is an error, and its error text ("" where none). Every error kind is reported, since the values come from the cells.

source
OpenDocumentSpreadsheets.geterror — Function
geterror(sheet, ref)
geterror(sheet, row, col)

The displayed text of an error result, such as "#DIV/0!" or "Err:502", or "" for a cell without one. For a range, a matrix of strings.

source
OpenDocumentSpreadsheets.getFormula — Function
getFormula(sheet, ref; raw=false) -> Union{String, Nothing}
getFormula(sheet, row, col; raw=false)
getFormula(ods, "Sheet1.A1"; raw=false)

The formula of a cell, as LibreOffice shows it ("=SUM(A1:B2,1)", "='My sheet'.A1*2"), or nothing if the cell has none. With raw=true, the formula as stored in the file ("of:=SUM([.A1:.B2];1)").

The UI notation follows LibreOffice with its en-US settings: , between function arguments and between the columns of an inline array, ; between its rows. Formulas written in another namespace than OpenFormula (such as msoxl:) lose their prefix and are otherwise returned unchanged.

Every cell of an array formula gives the formula in braces, as LibreOffice's formula bar shows it: "{=A1:A3*2}" (getArrayFormulas). With raw=true, only the first cell of its range has one, as it is stored.

source
OpenDocumentSpreadsheets.getArrayFormulas — Function
getArrayFormulas(sheet) -> Vector{CellRange}

The areas of the sheet's array formulas, in order of their first cells: each is the range that LibreOffice fills with the formula's results. getFormula on any of its cells gives the formula in braces ("{=A1:A3*2}").

setFormula(sh, "E1:E3"; val = "=A1:A3*2", array = true)
OpenDocumentSpreadsheets.getArrayFormulas(sh)   # [E1:E3]
source
OpenDocumentSpreadsheets.getRichTextString — Function
getRichTextString(sheet, ref) -> Union{RichTextString, Nothing}
getRichTextString(sheet, row, col) -> Union{RichTextString, Nothing}
getRichTextString(ods, "Sheet1!A1") -> Union{RichTextString, Nothing}

A text cell's rich text: its runs and their attributes, or nothing for a cell whose text has no runs of its own formatting (plain text, a number, an empty cell). It reads the cells written with a RichTextString and rich text made in LibreOffice (its spans' text styles), while their text is unchanged. A run's attributes are those its span sets: the rest are the cell's.

source
OpenDocumentSpreadsheets.RichTextString — Type
RichTextString(runs::RichTextRun...) -> RichTextString
RichTextString(runs::Vector{RichTextRun}) -> RichTextString

A cell's text made of runs, each with its own font attributes (see RichTextRun). Its text is the runs' joined; a "\n" starts a new line (a paragraph in ODF).

Written to a cell (sheet["A1"] = rt), each run with attributes is a span with a text style, as LibreOffice keeps one. A string of one run is written as plain text, the run's attributes the cell's font (setFont), but a superscript or subscript, which a cell style can't hold. getRichTextString reads one back.

source
OpenDocumentSpreadsheets.RichTextRun — Type
RichTextRun(text::AbstractString, pairs::Union{Nothing,Vector{Pair{Symbol,Any}}} = nothing) -> RichTextRun

One run of a RichTextString: its text and none, one or several font attributes:

  • :bold, :italic, :under, :strike: true to set it;
  • :vertAlign: "superscript" or "subscript";
  • :color: a colour, as hex ("FF0000", "FFFF0000") or a name ("red");
  • :size: the font size in points;
  • :name: the font's name.

An attribute a run doesn't set is the cell's, as in LibreOffice.

rt = RichTextString(RichTextRun("Water is H"), RichTextRun("2", [:vertAlign => "subscript"]),
                    RichTextRun("O!", [:bold => true]))
sh["A1"] = rt
source
Base.eachrow — Method
eachrow(sheet::Worksheet)

Iterate the rows of sheet that have content, as SheetRows, in order. Repeated rows are given one by one. With the cache on, the sheet is read into the cache first; with enable_cache=false (openods), rows are read as they are iterated.

for r in eachrow(ods["Sheet1"])
    println(row_number(r), ": ", r[1], ", ", r["B"])
end
source
OpenDocumentSpreadsheets.CellRef — Type
CellRef(ref::AbstractString)
CellRef(row, column)

A cell's position on a sheet, without the sheet: CellRef("B6") is column 2, row 6, and so is CellRef(6, 2). row_number and column_number give its row and column, and string its name. Anywhere a cell is given as a string ("B6"), a CellRef can be given instead.

c = CellRef("AB1")
row_number(c)              # 1
column_number(c)           # 28
string(CellRef(1, 28))     # "AB1"

SheetCellRef names the sheet too.

source
OpenDocumentSpreadsheets.SheetCellRef — Type
SheetCellRef(ref::AbstractString)
SheetCellRef(sheet::AbstractString, cellref::CellRef)

A cell on a named sheet, written as LibreOffice's Name Box shows it: SheetCellRef("Sheet1.B2"), or SheetCellRef("'My sheet'.B2") for a sheet whose name needs quotes. Its fields are sheet, the sheet's name, and cellref, a CellRef. It prints in the same form. Parsing also accepts $ marks ("$Sheet1.$B$2") and the form other spreadsheet programs use ("Sheet1!B2").

r = SheetCellRef("'My sheet'.B2")
r.sheet                                # "My sheet"
r.cellref                              # B2
SheetCellRef("Data", CellRef("A1"))    # Data.A1
source

Tables

OpenDocumentSpreadsheets.readtable — Function
readtable(source, [sheet, [columns]]; [table_name], [first_row], [column_labels], [header],
          [infer_eltypes], [stop_in_empty_row], [stop_in_row_function],
          [keep_empty_rows], [normalizenames], [missing_strings]) -> DataTable

Read a table, a block of rows under a header row, from a file path or IO: the table on sheet (a name or number; the first sheet if not given), as gettable reads it. The sheet is read row by row and not kept in memory.

using DataFrames
df = DataFrame(readtable("budget.ods", "Income"))
readtable("budget.ods", "Income", "A:B")          # only columns A and B

Use first_row to give the first row of the table (its header, if header=true). Without it, the table starts at the first row with data in its first column.

header (default true) says whether the first row holds the column labels. Without a header, and without column_labels, the labels are the column letters.

column_labels gives the labels as a vector of Symbols or strings.

normalizenames=true turns the labels into valid Julia identifiers.

missing_strings gives strings (one, or a vector) to read as missing.

infer_eltypes (default true) gives each column the narrowest element type of its values; otherwise columns are Vector{Any}.

stop_in_empty_row (default true) ends the table at the first empty row. stop_in_row_function is a function of a TableRow returning true at the row that ends the table (that row is left out).

keep_empty_rows (default false) keeps rows whose values are all missing between the first and the last row of the table.

table_name reads a database range (see table) instead: its data rows, without its header and totals rows, as gettable reads a Table, from sheet or, if none is given, from the whole file. The range's cells are its own, so columns, first_row, header, column_labels, stop_in_empty_row, stop_in_row_function and keep_empty_rows don't apply (columns with table_name is an error).

An enable_cache keyword is accepted, and has no effect.

source
OpenDocumentSpreadsheets.gettable — Function
gettable(sheet, [columns]; [first_row], [column_labels], [header], [infer_eltypes],
         [stop_in_empty_row], [stop_in_row_function], [keep_empty_rows],
         [normalizenames], [missing_strings]) -> DataTable

The table in sheet as a DataTable, which any Tables.jl sink accepts (DataFrame(gettable(sheet))). columns selects the columns ("B:D"); without it, the table's columns are found as in eachtablerow.

Use first_row to give the first row of the table (its header, if header=true). Without it, the table starts at the first row with data in its first column.

header (default true) says whether the first row holds the column labels. Without a header, and without column_labels, the labels are the column letters.

column_labels gives the labels as a vector of Symbols or strings.

normalizenames=true turns the labels into valid Julia identifiers.

missing_strings gives strings (one, or a vector) to read as missing.

infer_eltypes (default true) gives each column the narrowest element type of its values; otherwise columns are Vector{Any}.

stop_in_empty_row (default true) ends the table at the first empty row. stop_in_row_function is a function of a TableRow returning true at the row that ends the table (that row is left out).

keep_empty_rows (default false) keeps rows whose values are all missing between the first and the last row of the table.

source
gettable(t::Table; infer_eltypes=true, normalizenames=false, missing_strings=nothing) -> DataTable

A table's data rows (without its header and totals rows) as a DataTable, labelled by its columns: its range is the table's, so empty rows inside it are data. normalizenames, missing_strings and infer_eltypes are as for gettable(sheet).

source
OpenDocumentSpreadsheets.eachtablerow — Function
eachtablerow(sheet, [columns]; [first_row], [column_labels], [header],
             [stop_in_empty_row], [stop_in_row_function], [keep_empty_rows],
             [normalizenames], [missing_strings]) -> TableRowIterator

An iterator of the rows of the table in sheet, each a TableRow (index it with a column number or label: r[1], r[:name]). columns is a column range such as "B:E"; without it, the columns are the first run of consecutive non-empty cells in the table's first row.

Use first_row to give the first row of the table (its header, if header=true). Without it, the table starts at the first row with data in its first column.

header (default true) says whether the first row holds the column labels. Without a header, and without column_labels, the labels are the column letters.

column_labels gives the labels as a vector of Symbols or strings.

normalizenames=true turns the labels into valid Julia identifiers.

missing_strings gives strings (one, or a vector) to read as missing.

infer_eltypes (default true) gives each column the narrowest element type of its values; otherwise columns are Vector{Any}.

stop_in_empty_row (default true) ends the table at the first empty row. stop_in_row_function is a function of a TableRow returning true at the row that ends the table (that row is left out).

keep_empty_rows (default false) keeps rows whose values are all missing between the first and the last row of the table.

source
OpenDocumentSpreadsheets.TableRow — Type
TableRow

A row of a table, as eachtablerow gives it. Index it with a column number or label: r[1], r[:Amount]. row_number(r) is its position in the table (1 for the first row under the header), not its row on the sheet.

source

Writing

OpenDocumentSpreadsheets.setdata! — Function
setdata!(sheet, ref, value)
setdata!(sheet, row, col, value)
sheet[ref] = value
sheet[row, col] = value

Write value into a cell, or into every cell of a range. The file must be writable (openods with mode="rw" or "w", or newods).

  • value may be a number, string, Bool, Date, DateTime, Time, a period (a duration), or missing/nothing to empty the cell.
  • A matrix fills a range of its size.
  • A vector fills a row (dim=2, the default) or a column (dim=1) from a cell, or a one-row or one-column range.
  • ref takes the forms of getdata: "B2", "B2:D4", "Sheet1.B2", "Sheet1!B2", integers and ranges, or a defined name that refers to cells on the sheet.
  • With : for the rows or columns: ws[3, :] = [1, 2, 3] writes a vector along row 3 from column A, and ws[:, 2] = v down column B from row 1. Any other value fills the cells addressed, where : stands for the sheet's used columns or rows (ws[3, :] = 0, ws[:, 2:3] = missing, ws[:] = 1).

A cell keeps its style when that style's format fits the new value. Otherwise dates, date-times, times and booleans get ISO formats, and numbers and text the Default style.

source
OpenDocumentSpreadsheets.setFormula — Function
setFormula(sheet, ref; val, raw=false, array=false)
setFormula(sheet, row, col; val, raw=false, array=false)

Write a formula into a cell, or into every cell of a range (the same formula in each). val is in LibreOffice's notation, as getFormula gives it: "=SUM(B1:B3,'My sheet'.A1)". It is stored as OpenFormula (of:=SUM([.B1:.B3];['My sheet'.A1])). With raw=true, val is stored as given, and must be a stored formula such as "of:=[.A1]*2".

With array=true, the formula is one array formula over the whole range, as LibreOffice's Ctrl+Shift+Enter enters it over a selection: LibreOffice fills the range with its results, for example the values of "=UNIQUE(A2:A20)" or "=A2:A9*B2:B9". The range must be the size of the results: in a larger one LibreOffice shows #N/A in the cells left over, and a smaller one shows only part of them. A range of one cell holds an array formula with one result, such as "=SUM(A2:A9*B2:B9)". The cells of an array formula can only be changed together: writing to part of one is an error, and writing over all of it replaces it. See getArrayFormulas.

The cells' values are left empty: LibreOffice computes them when it opens the file.

setFormula(sh, "D1"; val = "=SUM(A1:A4)")
setFormula(sh, "D2:D4"; val = "=A2*2")                       # the same formula in each cell
setFormula(sh, "E2:E4"; val = "=A2:A4*B2:B4", array = true)  # one formula, three results
source
setFormula(ods::ODSFile, "Sheet1.A1", args...; kw...)

The same, on a cell or range given with its sheet.

source
OpenDocumentSpreadsheets.writetable — Function
writetable(filename, data, columnnames; overwrite=false, sheetname="", anchor_cell="A1", streaming=false, kw...)
writetable(filename, table; overwrite=false, sheetname="", anchor_cell="A1", streaming=false, kw...)
writetable(filename, "Sheet1" => table1, "Sheet2" => table2, ...; overwrite=false, streaming=false, kw...)
writetable(filename, [(sheetname, data, columnnames), ...]; overwrite=false, streaming=false, kw...)
writetable(filename; overwrite=false, streaming=false, Sheet1=(data, columnnames), ...)

Write tables to a new file (a path or an IO), one per sheet, each with a header row. The format follows the file's extension (.ods, .ots, .fods). An existing file is only replaced with overwrite=true. With streaming=true, rows are written as they are produced, in bounded memory (streamods); anchor_cell, totals and freeze_header are then not available. display_text=false leaves out the display text of number, date, time and boolean cells (smaller files, faster writes; see writeods). column_widths and column_formats lay out every sheet's columns, as in writetable!.

as_table=true makes each written range a table, as writetable! does (also streamed). A single table is named table_name, with its totals; with several sheets, each table is named after its sheet (made a valid name, with a warning, or the first free TableN).

sales = (Region = ["North", "South"], Total = [120, 95])
writetable("sales.ods", sales; sheetname = "Sales", overwrite = true)

writetable("report.ods", "Sales" => sales, "Costs" => (Item = ["Rent"], Amount = [800]);
           overwrite = true)                       # one sheet per table
source
OpenDocumentSpreadsheets.writetable! — Function
writetable!(sheet, data, columnnames; anchor_cell="A1", write_columnnames=true, column_widths,
            column_formats, as_table=false, table_name="", table_style=nothing, totals=nothing,
            freeze_header=false)
writetable!(sheet, table; kw...)

Write a table into sheet, with its column names as a header row (unless write_columnnames=false) and its top-left cell at anchor_cell. data is a vector of columns and columnnames their names; or table is any Tables.jl table.

  • column_widths: one width for every column, or a vector of widths by column (nothing leaves a column's width as it is), in characters as setColumnWidth takes them.
  • column_formats: a Dict from column (number from the first written, or name) to a number format, as setFormat takes it, applied to the column's data cells.
  • as_table=true makes the written cells a table (addtable!: LibreOffice's database range), named table_name ("": the first free TableN). It needs the header row. LibreOffice has no table styles, so table_style other than nothing or "None" is an error.
  • totals (with as_table) gives the table a totals row, as settotals! does: ["id" => "Total", "score" => :sum].
  • freeze_header=true freezes the rows down to the header (freezePanes).
source
OpenDocumentSpreadsheets.streamods — Function
streamods(f, dest; overwrite=false, version="1.4", display_text=true, declare_widths=[])

Write a new file to dest (a path or an IO) row by row, in bounded memory. f gets a StreamWriter: add sheets with addsheet!(s, name; columns) (a header row) or addsheet!(s, name, table) (a Tables.jl table, header and rows), and write rows with writerow! and writerows!. The format follows the extension (.ods, .ots; flat .fods is not streamed). display_text=false leaves out the display text of number, date, time and boolean cells, as in writeods.

Column widths (addsheet!(…; column_widths)) are declared at the start of the file, before its first sheet: a width a later sheet uses must be the first sheet's too, or be listed in declare_widths (in characters). writetable(…; streaming=true) declares them all.

streamods("big.ods") do s
    sh = addsheet!(s, "data"; columns = ["n", "square"])
    for n in 1:1_000_000
        writerow!(sh, (n, n^2))
    end
end
source
OpenDocumentSpreadsheets.writerow! — Function
writerow!(sh::StreamSheet, row)

Write the next row of a streamed sheet: a tuple, NamedTuple or vector of values (missing or nothing leave a cell empty).

source