A Python library to parse text out of any office file. Currently supports docx, pptx, xlsx, odt, odp, ods, pdf files.
pip install officeparserpyofficeparserpy
A Python library to parse text out of any office file.
Supported File Types
Install via pip
pip install officeparserpy
Library Usage
from officeparserpy import parse_office
# USING FILE BUFFERS
# instead of file path, you can also pass file buffers of one of the supported files
# on parse_office function.
# get file buffers
file_buffers = open("/path/to/officeFile", "rb").read()
# get parsed text from officeparserpy
# NOTE: Only works with parse_office. Private functions are not supported.
data = parse_office(file_buffers)
print(data)
Configuration Object: OfficeParserConfig
Optionally add a config object as a parameter to parse_office for the following configurations
| Flag | DataType | Default | Explanation |
|---|---|---|---|
| temp_files_location | string | officeparser_temp | The directory where officeparserpy stores the temp files. The final decompressed data will be put inside the officeparser_temp folder within your directory. Please ensure that this directory actually exists. Default is officeparser_temp. |
| preserve_temp_files | boolean | False | Flag to not delete the internal content files and the possible duplicate temp files that it uses after unzipping office files. Default is False. It always deletes all of those files. |
| output_error_to_console | boolean | False | Flag to show all the logs to the console in case of an error. Default is False. |