خرید بک لینک

Vote count: 0

I am reading an excel file using xlrd. Doing some macro replacing and then writing thru xlsxwriter. Without reading and copying formatting info the code works but when I add formatting info I get an error (at the bottom) The code snippet is below..I read a xls file, for each data row I replace token macros with the values and write back. when I try to close the output_workbook I get an error

    filePath = os.path.realpath(os.path.join(inputPath,filename))
    input_workbook = open_workbook(filePath, formatting_info=True)
    input_DataSheet = input_workbook.sheet_by_index(0)
    data = [[input_DataSheet.cell_value(r,c) for c in range(input_DataSheet.ncols)] for r in range(input_DataSheet.nrows)]

    output_workbook = xlsxwriter.Workbook('C:UsersManishDownloadsSuyDrexel_FundingMacroReplacerdemo.xlsx')
    output_worksheet = output_workbook.add_worksheet()

    for rowIndex, value in enumerate(data):
        copyItem = []

        for individualItem in value:
            tempItem = individualItem

            if (isinstance(individualItem, basestring)):
                tempItem = tempItem.replace("[{0}]".format(investorNameMacro), investorName)
                tempItem = tempItem.replace("[{0}]".format(investorPhoneMacro), investorPhone)
                tempItem = tempItem.replace("[{0}]".format(investorEmailMacro), investorEmail)
                tempItem = tempItem.replace("[{0}]".format(loanNumberMacro), loanNumber)

            copyItem.append(tempItem)

        for columnIndex, val in enumerate(copyItem):
            fmt =input_workbook.xf_list[input_DataSheet.cell(rowIndex,columnIndex).xf_index]
            output_worksheet.write(rowIndex,columnIndex, val,fmt)

    output_workbook.close()

The error that I get is

Traceback (most recent call last): File "C:/Users/Manish/Downloads/Suy/Drexel_Funding/MacroReplacer/drexelfundingmacroreplacer.py", line 87, in output_workbook.close() File "buildbdist.win-amd64eggxlsxwriterworkbook.py", line 297, in close File "buildbdist.win-amd64eggxlsxwriterworkbook.py", line 605, in _store_workbook File "buildbdist.win-amd64eggxlsxwriterpackager.py", line 131, in _create_package File "buildbdist.win-amd64eggxlsxwriterpackager.py", line 189, in _write_worksheet_files File "buildbdist.win-amd64eggxlsxwriterworksheet.py", line 3426, in _assemble_xml_file File "buildbdist.win-amd64eggxlsxwriterworksheet.py", line 4829, in _write_sheet_data File "buildbdist.win-amd64eggxlsxwriterworksheet.py", line 5015, in _write_rows File "buildbdist.win-amd64eggxlsxwriterworksheet.py", line 5183, in _write_cell AttributeError: 'XF' object has no attribute '_get_xf_index'

any help is appreciated

Thanks

asked 45 secs ago

برچسب: how to use snapchat,how to use uber,how to use apple pay,how to use a tampon,how to use excel,how to use twitter,how to use a french press,how to use instagram,how to use instagram stories,how to use airdrop, نویسنده: استخدام کار تاريخ: دوشنبه 25 مرداد 1395 ساعت: 7:12

صفحه بندی