# Buggy code
def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0):
    # Write the frame cells using xlsxwriter.

    sheet_name = self._get_sheet_name(sheet_name)

    if sheet_name in self.sheets:
        wks = self.sheets[sheet_name]
    else:
        wks = self.book.add_worksheet(sheet_name)
        self.sheets[sheet_name] = wks

    style_dict = {}

    for cell in cells:
        num_format_str = None
        if isinstance(cell.val, datetime.datetime):
            num_format_str = self.datetime_format
        elif isinstance(cell.val, datetime.date):
            num_format_str = self.date_format

        stylekey = json.dumps(cell.style)
        if num_format_str:
            stylekey += num_format_str

        if stylekey in style_dict:
            style = style_dict[stylekey]
        else:
            style = self._convert_to_style(cell.style, num_format_str)
            style_dict[stylekey] = style

        if cell.mergestart is not None and cell.mergeend is not None:
            wks.merge_range(
                startrow + cell.row,
                startcol + cell.col,
                startrow + cell.mergestart,
                startcol + cell.mergeend,
                cell.val,
                style,
            )
        else:
            wks.write(startrow + cell.row, startcol + cell.col, cell.val, style)


# Traceback (IndexError)
Traceback (most recent call last):
File "/Users/myourshaw/lab/pypeline/python2/excel_example.py", line 10, in <module>
xl_file.parse('Sheet1')
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/io/excel.py", line 208, in parse
**kwds)
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/io/excel.py", line 291, in _parse_excel
data[header] = _trim_excel_header(data[header])
IndexError: list index out of range

# Fixed code
def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0):
    # Write the frame cells using xlsxwriter.

    sheet_name = self._get_sheet_name(sheet_name)

    if sheet_name in self.sheets:
        wks = self.sheets[sheet_name]
    else:
        wks = self.book.add_worksheet(sheet_name)
        self.sheets[sheet_name] = wks

    style_dict = {}

    for cell in cells:
        val = _conv_value(cell.val)

        num_format_str = None
        if isinstance(cell.val, datetime.datetime):
            num_format_str = self.datetime_format
        elif isinstance(cell.val, datetime.date):
            num_format_str = self.date_format

        stylekey = json.dumps(cell.style)
        if num_format_str:
            stylekey += num_format_str

        if stylekey in style_dict:
            style = style_dict[stylekey]
        else:
            style = self._convert_to_style(cell.style, num_format_str)
            style_dict[stylekey] = style

        if cell.mergestart is not None and cell.mergeend is not None:
            wks.merge_range(
                startrow + cell.row,
                startcol + cell.col,
                startrow + cell.mergestart,
                startcol + cell.mergeend,
                cell.val,
                style,
            )
        else:
            wks.write(startrow + cell.row, startcol + cell.col, val, style)