LibreOfficeFileConverter
Convert Office documents, spreadsheets, and presentations to other formats using the LibreOffice command-line utility (soffice).
Key Features
- Converts DOC, DOCX, ODT, XLS, XLSX, PPT, PPTX, and other Office formats to PDF, DOCX, TXT, HTML, and more.
- Outputs
ByteStreamobjects that you can pass directly to Haystack document converters such asPyPDFToDocument. - Supports both synchronous and asynchronous execution.
- Accepts file paths,
Pathobjects, andByteStreaminputs. - Requires LibreOffice to be installed on the system where the pipeline runs.
Configuration
- Install LibreOffice on your system. For instructions, see the LibreOffice installation guide.
- Make sure the
sofficeexecutable is available in your system PATH. - Configure
LibreOfficeFileConverterin your pipeline YAML with the desiredoutput_file_type.
Connections
LibreOfficeFileConverter accepts file paths, Path objects, or ByteStream inputs as sources and returns a list of ByteStream objects as output. The output typically connects to a Haystack document converter such as PyPDFToDocument or DOCXToDocument to produce Document objects for downstream processing.
Source Code
To check this component's source code, open converter.py in the Haystack Core Integrations repository.
Usage Examples
Basic Configuration
libreoffice_converter:
type: haystack_integrations.components.converters.libreoffice.converter.LibreOfficeFileConverter
init_parameters:
output_file_type: pdf
Using the Component in a Pipeline
# haystack-pipeline
components:
libreoffice_converter:
type: haystack_integrations.components.converters.libreoffice.converter.LibreOfficeFileConverter
init_parameters:
output_file_type: pdf
pdf_converter:
type: haystack.components.converters.pypdf.PyPDFToDocument
init_parameters: {}
splitter:
type: haystack.components.preprocessors.document_splitter.DocumentSplitter
init_parameters:
split_by: word
split_length: 250
split_overlap: 30
writer:
type: haystack.components.writers.document_writer.DocumentWriter
init_parameters:
document_store:
type: haystack_integrations.document_stores.opensearch.document_store.OpenSearchDocumentStore
init_parameters:
hosts:
- ${OPENSEARCH_HOST}
index: libreoffice-demo
embedding_dim: 768
create_index: true
connections:
- sender: libreoffice_converter.output
receiver: pdf_converter.sources
- sender: pdf_converter.documents
receiver: splitter.documents
- sender: splitter.documents
receiver: writer.documents
inputs:
files:
- libreoffice_converter.sources
max_runs_per_component: 100
metadata: {}
Parameters
Init Parameters
These are the parameters you can configure in Pipeline Builder:
| Parameter | Type | Default | Description |
|---|---|---|---|
output_file_type | str | None | None | Target file format for conversion. Supported values: pdf, doc, docx, odt, rtf, txt, html, xlsx, xls, ods, csv, pptx, ppt, odp, epub, png, jpg. Must be a valid conversion target for the source file type. Can also be set at run time. |
Related Information
Was this page helpful?