Home > other >  Python USES xlutils. Copy. The copy () error index out of range
Python USES xlutils. Copy. The copy () error index out of range

Time:04-23

. Hello, everyone, I use Python xlrd2 open_workbook () reads the XLSX excel file, use xlutils. Copy. The copy () way to edit, insert the data, the current at the time of execution method, the code xlutils. Copy. The copy (), an "index out of range" problem, after A lot of time, I confirm to the cause of the problem, when the blank cells exist in the excel spreadsheet first line content, and the blank cells without operating all the lines when the maximum number of columns, he will report the error, such as the first row of data I have 4 g cell, 1, 2, 3, 4, the second line there are five data cell A B C D E, this time, the fifth column of the first line is empty, the second line is A letter E, this time will be an error "index out of range" I said, what are the members know how to solve the error, check A lot of places, found the irregular form data like me almost no, I have no way to, this form must first line exist some blank cells, is there A way to solve it

CodePudding user response:

I tried it on and create a new Excel spreadsheets, A1 cell input, empty, A2 cell B2 cell input, as shown in figure:

Xlrd2. Open_workbook (after), use copy code to duplicate the form data, must be an error "index out of range", people know how to do it,,,

CodePudding user response:

Just let it be, I think this problem except me this beginner, bosses are not met, so not online related cases, xlutils might be too old, to communicate with the library, the author, don't work for the he told me, it's too difficult,

CodePudding user response:

I contact the author of the library, the author told I recommend using openpyxl library, the problem cannot be solved,,, slipped slipped away,
  • Related