title: Pandas - Suppress call to _validate_archive? - Python 3.9.13/Pandas 1.4.2/Openpyxl 3.0.10
body: <p>I have been digging through questions/answers for the BadZipFile exception when calling read_excel() using the openpyxl engine. I looked at my error stack and dug into the Python files and it looks like ZipFile.py is being very strict when validating an archive. It is looking for an EOCD (end of central directory) signature in my XLSX archive file.</p>
  <p>When unzipping an archive, if the EOCD cannot be found or validated, there is supposed to be an error thrown when calling unzip in Linux, but I am not seeing it. I am unsure whether the EOCD is there/correct or not (anyone know of a tool to check?).</p>
  <p>However, from looking through my stack (below) I am examining what is happening in openpyxl/reader/excel.py. At line 67, the _validate_archive function is defined. I am wondering about the examination for a &quot;file like object&quot;.</p>
  <p>My use case is an AWS Lambda function which has an HTTP endpoint. I POST an Excel file (I am testing with Postman and using the binary body for the request where I select my Excel file) to the endpoint. The function needs to handle both CSV and XLSX. I include a custom header in which I specify the original file name. I split the filename, look at the extension, and either call read_csv or read_excel. read_csv is working great.</p>
  <p>Either way, the file is coming in as base64. For an XLSX file, Pandas handles this OK - up until we get to _validate_archive... What I am unsure of is how the &quot;file like object&quot; check at line 76...</p>
  <p>is_file_like = hasattr(filename, 'read')</p>
  <p>... interacts with the type by which the Base64 is handled. I am trying straight string (event[&quot;body&quot;]), the bytes() object, the BytesIO class, and the StringIO class, all to the same BadZipFile exception.</p>
  <h2>So... is it possible in Pandas/Openpyxl to suppress the validation of the archive? I want to be able to call read_excel() but not have the archive validated and see what happens.</h2>
  <p>My error stack:</p>
  <p>&quot;Error: (&lt;class 'zipfile.BadZipFile'&gt;, BadZipFile('File is not a zip file'),</p>
  <p>&lt;traceback object at 0x7f1019589dc0&gt;)\r\n&lt;class 'zipfile.BadZipFile'&gt;\r\n</p>
  <p>File is not a zip file\r\nTraceback (most recent call last):\n</p>
  <p>File &quot;/var/task/lambda_function.py&quot;, line 20, in lambda_handler\n    inv = pd.read_excel( bufferedString, engine='openpyxl', index_col=0 )\n</p>
  <p>File &quot;/opt/python/pandas/util/_decorators.py&quot;, line 311, in wrapper\n    return func(*args, **kwargs)\n</p>
  <p>File &quot;/opt/python/pandas/io/excel/_base.py&quot;, line 457, in read_excel\n    io = ExcelFile(io, storage_options=storage_options, engine=engine)\n</p>
  <p>File &quot;/opt/python/pandas/io/excel/_base.py&quot;, line 1419, in <strong>init</strong>\n    self._reader = self._engines[engine](self._io, storage_options=storage_options)\n</p>
  <p>File &quot;/opt/python/pandas/io/excel/_openpyxl.py&quot;, line 525, in <strong>init</strong>\n    super().<strong>init</strong>(filepath_or_buffer, storage_options=storage_options)\n</p>
  <p>File &quot;/opt/python/pandas/io/excel/_base.py&quot;, line 518, in <strong>init</strong>\n    self.book = self.load_workbook(self.handles.handle)\n</p>
  <p>File &quot;/opt/python/pandas/io/excel/_openpyxl.py&quot;, line 536, in load_workbook\n    return load_workbook(\n</p>
  <p>File &quot;/opt/python/openpyxl/reader/excel.py&quot;, line 315, in load_workbook\n    reader = ExcelReader(filename, read_only, keep_vba,\n</p>
  <p>File &quot;/opt/python/openpyxl/reader/excel.py&quot;, line 124, in <strong>init</strong>\n    self.archive = _validate_archive(fn)\n</p>
  <p>File &quot;/opt/python/openpyxl/reader/excel.py&quot;, line 96, in _validate_archive\n    archive = ZipFile(filename, 'r')\n</p>
  <p>File &quot;/var/lang/lib/python3.9/zipfile.py&quot;, line 1264, in <strong>init</strong>\n    self._RealGetContents()\n</p>
  <p>File &quot;/var/lang/lib/python3.9/zipfile.py&quot;, line 1331, in _RealGetContents\n</p>
  <p>raise BadZipFile(&quot;File is not a zip file&quot;)\n</p>
  <p>zipfile.BadZipFile: File is not a zip file\n&quot;</p>