awswrangler.s3.read_excel¶
- awswrangler.s3.read_excel(path: str, version_id: Optional[str] = None, use_threads: Union[bool, int] = True, boto3_session: Optional[Session] = None, s3_additional_kwargs: Optional[Dict[str, Any]] = None, **pandas_kwargs: Any) DataFrame ¶
Read EXCEL file(s) from a received S3 path.
Note
This function accepts any Pandas’s read_excel() argument. https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html
Note
Depending on the file extension (‘xlsx’, ‘xls’, ‘odf’…), an additional library might have to be installed first (e.g. xlrd).
Note
In case of use_threads=True the number of threads that will be spawned will be gotten from os.cpu_count().
- Parameters
path (str) – S3 path (e.g.
s3://bucket/key.xlsx
).version_id (Optional[str]) – Version id of the object.
use_threads (Union[bool, int]) – True to enable concurrent requests, False to disable multiple threads. If enabled os.cpu_count() will be used as the max number of threads. If given an int will use the given amount of threads. If integer is provided, specified number is used.
boto3_session (boto3.Session(), optional) – Boto3 Session. The default boto3 session will be used if boto3_session receive None.
s3_additional_kwargs (Optional[Dict[str, Any]]) – Forward to botocore requests, only “SSECustomerAlgorithm” and “SSECustomerKey” arguments will be considered.
pandas_kwargs – KEYWORD arguments forwarded to pandas.read_excel(). You can NOT pass pandas_kwargs explicit, just add valid Pandas arguments in the function call and awswrangler will accept it. e.g. wr.s3.read_excel(“s3://bucket/key.xlsx”, na_rep=””, verbose=True) https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html
- Returns
Pandas DataFrame.
- Return type
pandas.DataFrame
Examples
Reading an EXCEL file
>>> import awswrangler as wr >>> df = wr.s3.read_excel('s3://bucket/key.xlsx')