# Path: mfr/extensions/tabular/exceptions.py
# class TableTooBigError(TabularRendererError):
# 
#     __TYPE = 'tabular_table_too_big'
# 
#     def __init__(self, message, *args, code: int=400, nbr_cols: int=0, nbr_rows: int=0, **kwargs):
#         super().__init__(message, *args, code=code, **kwargs)
#         self.nbr_cols = nbr_cols
#         self.nbr_rows = nbr_rows
#         self.attr_stack.append([self.__TYPE, {
#             'nbr_cols': self.nbr_cols,
#             'nbr_rows': self.nbr_rows
#         }])
# 
# Path: mfr/extensions/tabular/utilities.py
# def header_population(headers):
#     """make column headers from a list
#     :param headers: list of column headers
#     :return: a list of dictionaries
#     """
#     return [{'id': field, 'name': field, 'field': field, 'sortable': True} for field in headers]


import xlrd
from collections import OrderedDict
from ..exceptions import TableTooBigError
from ..utilities import header_population
from mfr.extensions.tabular.compat import range, basestring

    for sheet in wb.sheets():
        if sheet.ncols > max_size or sheet.nrows > max_size:
            raise TableTooBigError('Table is too large to render.', '.xlsx',
                                   nbr_cols=sheet.ncols, nbr_rows=sheet.nrows)

        if sheet.ncols < 1 or sheet.nrows < 1:
            sheets[sheet.name] = ([], [])
            continue

        fields = sheet.row_values(0) if sheet.nrows else []

        fields = [
            str(value)
            if not isinstance(value, basestring) and value is not None
            else value or 'Unnamed: {0}'.format(index + 1)
            for index, value in enumerate(fields)
        ]

        data = []
        for i in range(1, sheet.nrows):
            row = []
            for cell in sheet.row(i):
                if cell.ctype == xlrd.XL_CELL_DATE:
                    value = xlrd.xldate.xldate_as_datetime(cell.value, wb.datemode).isoformat()
                else:
                    value = cell.value
                row.append(value)
            data.append(dict(zip(fields, row)))


# Path: mfr/extensions/tabular/exceptions.py
# class TableTooBigError(TabularRendererError):
# 
#     __TYPE = 'tabular_table_too_big'
# 
#     def __init__(self, message, *args, code: int=400, nbr_cols: int=0, nbr_rows: int=0, **kwargs):
#         super().__init__(message, *args, code=code, **kwargs)
#         self.nbr_cols = nbr_cols
#         self.nbr_rows = nbr_rows
#         self.attr_stack.append([self.__TYPE, {
#             'nbr_cols': self.nbr_cols,
#             'nbr_rows': self.nbr_rows
#         }])
# 
# Path: mfr/extensions/tabular/utilities.py
# def header_population(headers):
#     """make column headers from a list
#     :param headers: list of column headers
#     :return: a list of dictionaries
#     """
#     return [{'id': field, 'name': field, 'field': field, 'sortable': True} for field in headers]


# Path: mfr/extensions/tabular/libs/xlrd_tools.py
import xlrd
from collections import OrderedDict
from ..exceptions import TableTooBigError
from ..utilities import header_population
from mfr.extensions.tabular.compat import range, basestring


    for sheet in wb.sheets():
        if sheet.ncols > max_size or sheet.nrows > max_size:
            raise TableTooBigError('Table is too large to render.', '.xlsx',
                                   nbr_cols=sheet.ncols, nbr_rows=sheet.nrows)

        if sheet.ncols < 1 or sheet.nrows < 1:
            sheets[sheet.name] = ([], [])
            continue

        fields = sheet.row_values(0) if sheet.nrows else []

        fields = [
            str(value)
            if not isinstance(value, basestring) and value is not None
            else value or 'Unnamed: {0}'.format(index + 1)
            for index, value in enumerate(fields)
        ]

        data = []
        for i in range(1, sheet.nrows):
            row = []
            for cell in sheet.row(i):
                if cell.ctype == xlrd.XL_CELL_DATE:
                    value = xlrd.xldate.xldate_as_datetime(cell.value, wb.datemode).isoformat()
                else:
                    value = cell.value
                row.append(value)
            data.append(dict(zip(fields, row)))


        header = header_population(fields)