diff --git a/python/fastexcel/__init__.py b/python/fastexcel/__init__.py index fa42fb6..9f7c0ee 100644 --- a/python/fastexcel/__init__.py +++ b/python/fastexcel/__init__.py @@ -3,9 +3,13 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: + from pathlib import Path + import pandas as pd import polars as pl +from os.path import expanduser + import pyarrow as pa from ._fastexcel import __version__, _ExcelReader, _ExcelSheet @@ -173,12 +177,12 @@ def __repr__(self) -> str: return self._reader.__repr__() -def read_excel(path: str) -> ExcelReader: +def read_excel(path: Path | str) -> ExcelReader: """Opens and loads an excel file. :param path: The path to the file """ - return ExcelReader(_read_excel(path)) + return ExcelReader(_read_excel(expanduser(path))) __all__ = ("ExcelReader", "ExcelSheet", "read_excel", "__version__")