05. Excel

Excel

UnstructuredExcelLoader Is Microsoft Excel Used to load files.

This loader works on both .xlsx and .xls files. The page content will be the raw text of the Excel file.

When using the loader in "elements" mode, an HTML representation of the Excel file is provided under the text_as_html key in the document metadata.

Copy

# installation
# !pip install -qU langchain-community unstructured openpyxl

Copy

from langchain_community.document_loaders import UnstructuredExcelLoader

# UnstructuredExcelLoader generation
loader = UnstructuredExcelLoader("./data/titanic.xlsx", mode="elements")

# load document
docs = loader.load()

# Output document length
print(len(docs))

Verify that it is loaded as one document.

Copy

Copy

Copy

Copy

DataFrameLoader

  • Just like a CSV file, we use the read_excel() function to load an Excel file, create it as a DataFrame, and then load it.

Copy

Copy

Copy

Last updated