
    	hE0                        S r SSKJrJr  SSKJr  SSKrSSKrSSK	J
r
   SSKJr  SS	KJr  SS
KJrJrJrJrJrJrJrJrJrJrJr  SSKJr  SSKJr  SSK J!r!J"r"  SSK#J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  SSK+J,r,J-r-  SSK.J/r/J0r0J1r1  SSK2J3r3  SSK4J5r5  SSK6J7r7  SSK8J9r9  SSK:J;r;  SSK<J=r=  SSK>J?r?  Sr@S rAS rB " S S 5      rCS\SS!S4S" jrDg! \ a    Sr Nf = f)#zRead an xlsx file into Python    )ZipFileZIP_DEFLATED)BytesION)TableDefinition   )KEEP_VBAF)InvalidFileException)ARC_CORE
ARC_CUSTOMARC_CONTENT_TYPESARC_WORKBOOK	ARC_THEMECOMMENTS_NSSHARED_STRINGSXLTMXLTXXLSMXLSX)
MergedCell)CommentSheet   )read_string_tableread_rich_text)WorkbookParser)apply_stylesheet)DocumentProperties)CustomPropertyList)ManifestOverride)RelationshipListget_dependentsget_rels_path)ReadOnlyWorksheet)WorksheetReader)
Chartsheet)Table)SpreadsheetDrawing)
fromstring)find_images)z.xlsxz.xlsmz.xltxz.xltmc                 ,   [        U S5      nU(       dt  [        R                  R                  U 5      S   R	                  5       nU[
        ;  a:  US:X  a  SnO&US:X  a  SnOSU< SS	R                  [
        5      < 3n[        U5      e[        U S
5      nU$ )a  
Does a first check whether filename is a string or a file-like
object. If it is a string representing a filename, a check is done
for supported formats by checking the given file-extension. If the
file-extension is not in SUPPORTED_FORMATS an InvalidFileException
will raised. Otherwise the filename (resp. file-like object) will
forwarded to zipfile.ZipFile returning a ZipFile-Instance.
readz.xlszopenpyxl does not support the old .xls file format, please use xlrd to read this file, or convert it to the more recent .xlsx file format.z.xlsbz|openpyxl does not support binary format .xlsb, please convert this file to .xlsx format if you want to open it with openpyxlzopenpyxl does not support zT file format, please check you can open it with Excel first. Supported formats are: ,r)	hasattrospathsplitextlowerSUPPORTED_FORMATSjoinr	   r   )filenameis_file_likefile_formatmsgarchives        G/var/www/html/env/lib/python3.13/site-packages/openpyxl/reader/excel.py_validate_archiver<   B   s     8V,Lgg&&x04::<//f$< '2 ( 8C7:xx@Q7R	T
 's++h$GN    c                 N   [         [        [        [        /nU H  nU R	                  U5      nU(       d  M  Us  $    U R
                   Vs1 s H  oDR                  iM     nnU[        U5      -  nU(       a!  [        S[        -   UR                  5       5      $ [        S5      es  snf )N/z$File contains no valid workbook part)r   r   r   r   findDefaultContentTypesetr   r   popIOError)packageworkbook_typesctpartpdefaultsworkbook_types          r;   _find_workbook_partrM   c   s    D$-N||B4K  (/7!H7s>22Ml*M,=,=,?@@
8
99 8s   
B"c                   b    \ rS rSrSrS\SSS4S jrS rS rS r	S	 r
S
 rS rS rS rS rSrg)ExcelReaders   zI
Read an Excel package and dispatch the contents to the relevant modules
FTc                     [        U5      U l        U R                  R                  5       U l        X l        X0l        X@l        XPl        X`l        / U l	        g N)
r<   r:   namelistvalid_files	read_onlykeep_vba	data_only
keep_links	rich_textshared_strings)selffnrU   rV   rW   rX   rY   s          r;   __init__ExcelReader.__init__y   sD    (,<<002" "$" r=   c                     U R                   R                  [        5      n[        U5      n[        R
                  " U5      U l        g rR   )r:   r+   r   r(   r   	from_treerF   )r[   srcroots      r;   read_manifestExcelReader.read_manifest   s2    ll 12#))$/r=   c                 &   U R                   R                  [        5      n[        nU R                  (       a  [
        nUbA  UR                  SS  nU R                  R                  U5       nU" U5      U l	        S S S 5        g g ! , (       d  f       g = f)Nr   )
rF   r@   r   r   rY   r   PartNamer:   openrZ   )r[   rH   readerstrings_pathra   s        r;   read_stringsExcelReader.read_strings   so    \\~.">>#F>;;qr?L""<1S&,Sk# 21 11s   *B
Bc                    [        U R                  5      n[        U R                  UR                  SS  U R
                  S9U l        U R                  R                  5         U R                  R                  n/ Ul	        U R                  Ul        U R                  Ul        UR                  [        [         4;   Ul        U R$                  (       ae  ['        [)        5       S[*        5      Ul        U R.                   H7  nUR,                  R1                  X0R                  R3                  U5      5        M9     U R                  (       a  U R                  Ul        X l        g )Nr   )rX   a)rM   rF   r   r:   rf   rX   parserparsewb_sheetsrW   
_data_onlyrU   
_read_onlyrB   r   r   templaterV   r   r   r   vba_archiverT   writestrr+   _archive)r[   wb_partrp   names       r;   read_workbookExcelReader.read_workbook   s    %dll3$T\\73C3CAB3GTXTcTcd[[^^
))dD\9 ==$WY\BBN((''ll.?.?.EF ) >>,,BKr=   c                     [         U R                  ;   aN  [        U R                  R	                  [         5      5      n[
        R                  " U5      U R                  l        g g rR   )	r
   rT   r(   r:   r+   r   r`   rp   
propertiesr[   ra   s     r;   read_propertiesExcelReader.read_properties   sE    t'''T\\..x89C!3!=!=c!BDGG (r=   c                     [         U R                  ;   aN  [        U R                  R	                  [         5      5      n[
        R                  " U5      U R                  l        g g rR   )	r   rT   r(   r:   r+   r   r`   rp   custom_doc_propsr~   s     r;   read_customExcelReader.read_custom   sE    )))T\\..z:;C'9'C'CC'HDGG$ *r=   c                     [         U R                  ;   a/  U R                  R                  [         5      U R                  l        g g rR   )r   rT   r:   r+   rp   loaded_theme)r[   s    r;   
read_themeExcelReader.read_theme   s0    (((#'<<#4#4Y#?DGG  )r=   c                    UR                   n[        U5      n/ nX@R                  ;   a  [        U R                  U5      nU R                  R                  US5       nUR                  5       nS S S 5        [        W5      n[        R                  " U5      n	U R                  U	l        UR                  U	l        U R                  R                  U	5        UR                  [         R"                  5      n
U
 H?  n[%        U R                  UR                   5      u  pU H  nU	R'                  U5        M     MA     g ! , (       d  f       N= f)Nr.   )targetr"   rT   r!   r:   rg   r+   r(   r%   r`   rp   _parentry   title
_add_sheetr@   r'   	_rel_typer)   	add_chart)r[   sheetrel
sheet_path	rels_pathrelsra   xmlnodecsdrawingschartsimagescs                 r;   read_chartsheetExcelReader.read_chartsheet   s    ZZ
!*-	(((!$,,	:D\\z3/3((*C 0#!!$'WW
::299/99:C(szzBNFQ   0/s   D77
Ec           
      |	   SnU R                   R                  5        GH2  u  p#UR                  U R                  ;  a  M"  SUR                  ;   a  U R                  X#5        ME  [        UR                  5      n[        5       nX@R                  ;   a  [        U R                  U5      nU R                  (       ao  [        U R                  UR                  UR                  U R                  5      nUR                  Ul        U R                  R"                  R%                  U5        GM	  U R                  R'                  UR                  5      nU R                  R)                  UR                  5      nXVl        [-        XgU R                  U R.                  U R0                  5      nUR3                  5         UR5                  5         UR7                  [8        5       Hf  n	U R                  R;                  U	R                  5      n
[<        R>                  " [A        U
5      5      nURB                   H  u  p XU   l"        M     Mh     U R                  RV                  (       a<  URX                  (       a+  UR[                  URX                  5      R                  Ul,        OS Ul,        UR\                   HP  nU R                  R;                  U5      n
[A        U
5      n[^        R>                  " U5      nURa                  U5        MR     UR7                  [b        Rd                  5      nU Ho  n[g        U R                  UR                  5      u  nnU H  nURi                  XRj                  5        M      U H  nURm                  UURj                  5        M!     Mq     UR7                  [n        Rp                  5      nU R                   Rr                  nU Hp  n	U	Rt                  nU R                  R;                  U5      n
[A        U
5      n[n        R>                  " U5      nUURv                     Ul<        UR{                  U5        Mr     UR                  Ul        GM5     g ! [F         a\    Xl   n[I        U[J        5      (       a>  [L        RN                  " URQ                  URR                  URT                  5      5         GM   GM  f = f)Nz~Cell '{0}':{1} is part of a merged range but has a comment which will be removed because merged cells cannot contain any data.
chartsheet)>rn   find_sheetsr   rT   Typer   r"   r    r!   r:   rU   r#   rp   ry   rZ   statesheet_staterq   appendrg   create_sheet_relsr$   rW   rY   bind_allcloser@   r   r+   r   r`   r(   commentscommentAttributeError
isinstancer   warningswarnformatr   
coordinateru   legacy_drawinggettablesr&   	add_tabler'   r   r)   r   anchor	add_imager   rel_typepivot_cachesTargetcacheIdcache	add_pivot)r[   comment_warningr   r   r   r   wsfh	ws_parserr.   ra   comment_sheetrefr   r   tr   tabler   r   r   im	pivot_relr   
pivot_pathtreepivots                              r;   read_worksheetsExcelReader.read_worksheets   sp    _++113JEzz!1!11sxx'$$U0%cjj1I#%D,,,%dllI>~~&tww

CJJH[H[\!&&&r*\\&&szz2WW))%**5+BD4G4GY]YgYgh	""$
 YY{+ll''1 , 6 6z# G$1$:$:LC%*13 %; , ww""r'8'8$(HHR->->$?$F$F!$(!%%ll''* o,U#	 & yy!3!=!=>H!,T\\3::!FALLHH-   BLLRYY/ !	   		/":":;I;;33LXX
ll''
3!#'11$7*5==9U#  #[[BNK 4B * %G%a44$MM/*@*@1<<*XY$ 5%s   0	QAR;	:R;	c                 H   Sn U R                  5         SnU R                  5         SnU R                  5         SnU R                  5         SnU R	                  5         SnU R                  5         Sn[        U R                  U R                  5        SnU R                  5         S	nU R                  R                  5         U R                  (       d  U R                  R                  5         g g ! [         a,  n[        S
U SU R                  R                   S35      UeS nAff = f)Nzread manifestzread stringszread workbookzread propertieszread custom propertiesz
read themezread stylesheetzread worksheetszassign namesz#Unable to read workbook: could not z from z~.
This is most probably because the workbook source files contain some invalid XML.
Please see the exception for more details.)rc   rj   rz   r   r   r   r   r:   rp   r   rn   assign_namesrU   r   
ValueErrorr6   )r[   actiones      r;   r+   ExcelReader.read  s	    	 #F$F &F  "-F!FOO&FT\\4773&F  "#FKK$$&>>""$ " 	5fXVDLLDYDYCZ [= = 		s   C%C+ +
D!5'DD!)r:   rW   rX   rV   rF   rn   rU   rY   rZ   rT   rp   N)__name__
__module____qualname____firstlineno____doc__r   r]   rc   rj   rz   r   r   r   r   r   r+   __static_attributes__ r=   r;   rO   rO   s   sL     &+X TU	!02.CI@
 ,G)Tr=   rO   Tc                 V    [        XUX4U5      nUR                  5         UR                  $ )a  Open the given filename and return the workbook

:param filename: the path to open or a file-like object
:type filename: string or a file-like object open in binary mode c.f., :class:`zipfile.ZipFile`

:param read_only: optimised for reading, content cannot be edited
:type read_only: bool

:param keep_vba: preserve vba content (this does NOT mean you can use it)
:type keep_vba: bool

:param data_only: controls whether cells with formulae have either the formula (default) or the value stored the last time Excel read the sheet
:type data_only: bool

:param keep_links: whether links to external workbooks should be preserved. The default is True
:type keep_links: bool

:param rich_text: if set to True openpyxl will preserve any rich text formatting in cells. The default is False
:type rich_text: bool

:rtype: :class:`openpyxl.workbook.Workbook`

.. note::

    When using lazy load, all worksheets will be :class:`openpyxl.worksheet.iter_worksheet.IterableWorksheet`
    and the returned workbook will be read-only.

)rO   r+   rp   )r6   rU   rV   rW   rX   rY   rh   s          r;   load_workbookr   <  s*    < h"	;F
KKM99r=   )Er   zipfiler   r   ior   os.pathr0   r   openpyxl.pivot.tabler   testsr   ImportErroropenpyxl.utils.exceptionsr	   openpyxl.xml.constantsr
   r   r   r   r   r   r   r   r   r   r   openpyxl.cellr   openpyxl.comments.comment_sheetr   stringsr   r   workbookr   openpyxl.styles.stylesheetr   openpyxl.packaging.corer   openpyxl.packaging.customr   openpyxl.packaging.manifestr   r   openpyxl.packaging.relationshipr    r!   r"   openpyxl.worksheet._read_onlyr#   openpyxl.worksheet._readerr$   openpyxl.chartsheetr%   openpyxl.worksheet.tabler&   $openpyxl.drawing.spreadsheet_drawingr'   openpyxl.xml.functionsr(   r   r)   r4   r<   rM   rO   r   r   r=   r;   <module>r      s    $ *    0 
 ;    % 8 6 $ 7 6 8 :  < 6 * * C - ! 9 B: F FR ',h!de!W	  Hs   C CC