polars.read_ods#
- polars.read_ods(
 - source: str | BytesIO | Path | BinaryIO | bytes,
 - *,
 - sheet_id: None = None,
 - sheet_name: str,
 - schema_overrides: SchemaDict | None = None,
 - raise_if_empty: bool = True,
 - polars.read_ods(
 - source: str | BytesIO | Path | BinaryIO | bytes,
 - *,
 - sheet_id: None = None,
 - sheet_name: None = None,
 - schema_overrides: SchemaDict | None = None,
 - raise_if_empty: bool = True,
 - polars.read_ods(
 - source: str | BytesIO | Path | BinaryIO | bytes,
 - *,
 - sheet_id: int,
 - sheet_name: str,
 - schema_overrides: SchemaDict | None = None,
 - raise_if_empty: bool = True,
 - polars.read_ods(
 - source: str | BytesIO | Path | BinaryIO | bytes,
 - *,
 - sheet_id: Literal[0] | Sequence[int],
 - sheet_name: None = None,
 - schema_overrides: SchemaDict | None = None,
 - raise_if_empty: bool = True,
 - polars.read_ods(
 - source: str | BytesIO | Path | BinaryIO | bytes,
 - *,
 - sheet_id: int,
 - sheet_name: None = None,
 - schema_overrides: SchemaDict | None = None,
 - raise_if_empty: bool = True,
 - polars.read_ods(
 - source: str | BytesIO | Path | BinaryIO | bytes,
 - *,
 - sheet_id: None,
 - sheet_name: list[str] | tuple[str],
 - schema_overrides: SchemaDict | None = None,
 - raise_if_empty: bool = True,
 Read OpenOffice (ODS) spreadsheet data into a DataFrame.
- Parameters:
 - source
 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 (e.g. via builtinopenfunction) orBytesIO).- sheet_id
 Sheet number(s) to convert, starting from 1 (set
0to load all worksheets as DataFrames) and return a{sheetname:frame,}dict. (Defaults to1if neither this norsheet_nameare specified). Can also take a sequence of sheet numbers.- sheet_name
 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.- schema_overrides
 Support type specification or override of one or more columns.
- raise_if_empty
 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.
- Returns:
 - DataFrame, or a 
{sheetname: DataFrame, ...}dict if reading multiple sheets. 
- DataFrame, or a 
 
Examples
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_overridesparameter to specify them.>>> pl.read_ods( ... source="test.ods", ... sheet_id=3, ... schema_overrides={"dt": pl.Date}, ... raise_if_empty=False, ... )