Error reading xlsm file

76 views
Skip to first unread message

Jonathan Antunes

unread,
Jan 8, 2016, 12:33:27 PM1/8/16
to python-excel
This is my code to read xlsm file:

import openpyxl
xfile = openpyxl.load_workbook('C:\Python27\FCREHXMLv2.xlsm')

sheet = xfile.get_sheet_by_index(4)
print(sheet.name)

I've got this error:

Traceback (most recent call last):
  File "teste.py", line 12, in <module>
    xfile = openpyxl.load_workbook('C:\Python27\FCREHXMLv2.xlsm')
    File "C:\Python27\lib\site-packages\openpyxl\reader\excel.py", line 192, in load_workbook
   
    shared_strings = read_string_table(archive.read(strings_path))
    File "C:\Python27\lib\site-packages\openpyxl\reader\strings.py", line 21, in read_string_table
    
    text = Text.from_tree(node).content
    File "C:\Python27\lib\site-packages\openpyxl\cell\text.py", line 185, in content
    return "".join(snippets)
    
    TypeError: sequence item 2: expected string or Unicode, NoneType found

Someone already had this error and how to fixed it

Jonathan Antunes



Charlie Clark

unread,
Jan 8, 2016, 12:40:58 PM1/8/16
to python...@googlegroups.com
Am .01.2016, 17:55 Uhr, schrieb Jonathan Antunes <joni...@gmail.com>:

> Someone already had this error and how to fixed it

Yes, it's a known error and already fixed in the 2.3 branch:

https://openpyxl.readthedocs.org/en/default/#working-with-a-checkout

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
Reply all
Reply to author
Forward
0 new messages