source: str | Path | IO[bytes] | bytes,
sheet_id: int | Sequence[int] | None = None,
sheet_name: str | list[str] | tuple[str] | None = None,
schema_overrides: SchemaDict | None = None,
infer_schema_length: int | None = 100,
raise_if_empty: bool = True,
) DataFrame | dict[str, DataFrame][source]#

Read OpenOffice (ODS) spreadsheet data into a DataFrame.


Path to a file or a file-like object (by “file-like object” we refer to objects that have a read() method, such as a file handler like the builtin open function, or a BytesIO instance).


Sheet number(s) to convert, starting from 1 (set 0 to load all worksheets as DataFrames) and return a {sheetname:frame,} dict. (Defaults to 1 if neither this nor sheet_name are specified). Can also take a sequence of sheet numbers.


Sheet name(s) to convert; cannot be used in conjunction with sheet_id. If more than one is given then a {sheetname:frame,} dict is returned.


Support type specification or override of one or more columns.


The maximum number of rows to scan for schema inference. If set to None, the entire dataset is scanned to determine the dtypes, which can slow parsing for large workbooks.


When there is no data in the sheet,`NoDataError` is raised. If this parameter is set to False, an empty DataFrame (with no columns) is returned instead.

DataFrame, or a {sheetname: DataFrame, ...} dict if reading multiple sheets.


Read the “data” worksheet from an OpenOffice spreadsheet file into a DataFrame.

>>> pl.read_ods(
...     source="test.ods",
...     sheet_name="data",
... )

If the correct dtypes can’t be determined, use the schema_overrides parameter to specify them, or increase the inference length with infer_schema_length.

>>> pl.read_ods(
...     source="test.ods",
...     sheet_id=3,
...     schema_overrides={"dt": pl.Date},
...     raise_if_empty=False,
... )