简体   繁体   中英

openpyxl load_workbook error: iteration over non sequence type

when i try to load_worbook (its a empty xlsx file) it get a error.

import openpyxl as op

wb = op.load_workbook(filename = 'C:\EXCEL TEST\TS.xlsx')

error

Runtime error (TypeErrorException): iteration over non-sequence of type Sequence

Traceback:
  line 154, in find, "C:\RhinoPython\openpyxl\packaging\manifest.py"
  line 163, in findall, "C:\RhinoPython\openpyxl\packaging\manifest.py"
  line 142, in read_strings, "C:\RhinoPython\openpyxl\reader\excel.py"
  line 269, in read, "C:\RhinoPython\openpyxl\reader\excel.py"
  line 312, in load_workbook, "C:\RhinoPython\openpyxl\reader\excel.py"
  line 14, in script

Any tip is welcome

You can try following sometimes its getting error because cells containing formulas not data. try following and see read_only=True is optional by the way

op.load_workbook(<file name>,data_only=True,read_only=True)

For further reading follow this link

Replace file path value C:\\EXCEL TEST\\TS.xlsx with C:\\\\EXCEL TEST\\\\TS.xlsx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM