
    Ng                     V    d Z ddlmZ ddlmZmZmZ ddlmZm	Z	  G d de          Z
dS )zLoads Microsoft Excel files.    )Path)AnyListUnion)UnstructuredFileLoadervalidate_unstructured_versionc                   P     e Zd ZdZ	 d	deeef         dedef fdZde	fdZ
 xZS )
UnstructuredExcelLoadera  Load Microsoft Excel files using `Unstructured`.

    Like other
    Unstructured loaders, UnstructuredExcelLoader can be used in both
    "single" and "elements" mode. If you use the loader in "elements"
    mode, each sheet in the Excel file will be an Unstructured Table
    element. If you use the loader in "single" mode, an
    HTML representation of the table will be available in the
    "text_as_html" key in the document metadata.

    Examples
    --------
    from langchain_community.document_loaders.excel import UnstructuredExcelLoader

    loader = UnstructuredExcelLoader("stanley-cups.xlsx", mode="elements")
    docs = loader.load()
    single	file_pathmodeunstructured_kwargsc                 `    t          d            t                      j        d||d| dS )a4  

        Args:
            file_path: The path to the Microsoft Excel file.
            mode: The mode to use when partitioning the file. See unstructured docs
              for more info. Optional. Defaults to "single".
            **unstructured_kwargs: Keyword arguments to pass to unstructured.
        z0.6.7)min_unstructured_version)r   r   N )r   super__init__)selfr   r   r   	__class__s       f/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/document_loaders/excel.pyr   z UnstructuredExcelLoader.__init__   sA     	&wGGGGO94OO;NOOOOO    returnc                 6    ddl m}  |dd| j        i| j        S )Nr   )partition_xlsxfilenamer   )unstructured.partition.xlsxr   r   r   )r   r   s     r   _get_elementsz%UnstructuredExcelLoader._get_elements0   s4    >>>>>>~RRt~R9QRRRr   )r   )__name__
__module____qualname____doc__r   strr   r   r   r   r   __classcell__)r   s   @r   r
   r
      s         * P Pd#P P  #	P P P P P P"St S S S S S S S Sr   r
   N)r!   pathlibr   typingr   r   r   1langchain_community.document_loaders.unstructuredr   r   r
   r   r   r   <module>r'      s    " "       # # # # # # # # # #       'S 'S 'S 'S 'S4 'S 'S 'S 'S 'Sr   