Source code for formulas.excel.xlreader

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2016-2019 European Commission (JRC);
# Licensed under the EUPL (the 'Licence');
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl

"""
It provides a custom Excel Reader class.
"""
from openpyxl.reader.excel import ExcelReader


[docs]class XlReader(ExcelReader):
[docs] def __init__(self, *args, raw_date=True, **kwargs): super(XlReader, self).__init__(*args, **kwargs) self.raw_date, self._date_formats = raw_date, set()
[docs] def read_worksheets(self): if self.raw_date: self._date_formats = self.wb._date_formats self.wb._date_formats = set() super(XlReader, self).read_worksheets()
[docs]def load_workbook(filename, **kw): reader = XlReader(filename, **kw) reader.read() return reader.wb