Failing to open spreadsheet

Stephen

I am currently parsing multiple spread sheets and running into problems opening a few of them. The error that is produced directs me to the file "Cell\text.py" at the line that joins the snippets together in the content property.

workBook = openpyxl.load_workbook(filepath, True)

File "C:\Python34\lib\site-packages\openpyxl-2.3.1-py3.4.egg\openpyxl\reader\excel.py", line 191, in load_workbook

shared_strings = read_string_table(archive.read(strings_path))

File "C:\Python34\lib\site-packages\openpyxl-2.3.1-py3.4.egg\openpyxl\reader\strings.py", line 21, in read_string_table

text = Text.from_tree(node).content

File "C:\Python34\lib\site-packages\openpyxl-2.3.1-py3.4.egg\openpyxl\cell\text.py", line 182, in content

return "".join(snippets)

TypeError: sequence item 3: expected str instance, NoneType found

If I alter the code to have a check around the appending of the blocks in the formatted section as follows:

for block in self.formatted:
        if(block.t is not None):                
            snippets.append(block.t)

It works fine, I was just wondering if there is some obvious problem with the excel sheet that I don't understand that someone could shed light on. I haven't rooted around the code for openpyxl so I am not sure what determines the contents of "self.formatted" but, My guess is that it is something caused by the merged cells in that area of the spread sheet.

EDIT

After reading your comments I dived a little deeper to see if there is any data I could share with you. I updated the Content property("Cell/Text.py") to output the data it was trying to join and searched the "sharedStrings.xml" for the xml data. The printed data was:

 ['“Replaced Data”', None]

After taking a look in the sharedStrings file the xml that contains this data is:

<si>
  <r>
    <t>“Replaced Data”</t>
  </r>
  <r>
    <rPr>
      <sz val="11"/>
      <color rgb="FF008080"/>
      <rFont val="Calibri"/>
      <family val="2"/>
      <scheme val="minor"/>
    </rPr>
  <t/>
  </r>
</si>
Charlie Clark

This has nothing to do with merged cells but with the way text has been stored. Could you submit a bug report with a test file?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Open Google spreadsheet with the cursor on last working cell

From Dev

Applescript failing to open app in new window

From Dev

Open each spreadsheet in a new instance of Excel in Windows 7

From Dev

Google Spreadsheet: How can I leave the Script Editor open in another tab after refreshing a spreadsheet

From Dev

ifstream failing to open

From Dev

Export to excel spreadsheet (XLSX) failing

From Dev

Excel cannot open .xlsx file created with Spreadsheet::WriteExcel

From Dev

Open google spreadsheet with .net

From Dev

Google spreadsheet / docs , jump to current date cell on Open

From Dev

Eclipse failing to open

From Dev

URI must be ascii only when Spreadsheet open file?

From Dev

Excel cannot open Gembox Spreadsheet file

From Dev

Open Existing Spreadsheet via Google App Script

From Dev

Double Clicking an Excel File Will Open Excel but not the Spreadsheet itself

From Dev

Open office spreadsheet, export as PDF as single large page?

From Dev

Applescript failing to open app in new window

From Dev

Sublime running Ruby code can't open a spreadsheet

From Dev

Google Spreadsheet: How can I leave the Script Editor open in another tab after refreshing a spreadsheet

From Dev

Custom Open Graph Story failing Facebook review

From Dev

google spreadsheet json format (How to open)

From Dev

I want to open a Link in my google document (no spreadsheet) directely by menu

From Dev

Google Script to open URL in same window as Spreadsheet

From Dev

VBS script to open excel to call macro failing

From Dev

Open Source Web Form Builder With Save to Spreadsheet or Database

From Dev

Open CSV File And Go Straight To Spreadsheet

From Dev

Open google spreadsheet with .net

From Dev

How to open a folder from a list in an Excel spreadsheet using VBA

From Dev

Find element byXpath failing when reading from a spreadsheet cell

From Dev

FPDF - failing to open eps file?

Related Related

  1. 1

    Open Google spreadsheet with the cursor on last working cell

  2. 2

    Applescript failing to open app in new window

  3. 3

    Open each spreadsheet in a new instance of Excel in Windows 7

  4. 4

    Google Spreadsheet: How can I leave the Script Editor open in another tab after refreshing a spreadsheet

  5. 5

    ifstream failing to open

  6. 6

    Export to excel spreadsheet (XLSX) failing

  7. 7

    Excel cannot open .xlsx file created with Spreadsheet::WriteExcel

  8. 8

    Open google spreadsheet with .net

  9. 9

    Google spreadsheet / docs , jump to current date cell on Open

  10. 10

    Eclipse failing to open

  11. 11

    URI must be ascii only when Spreadsheet open file?

  12. 12

    Excel cannot open Gembox Spreadsheet file

  13. 13

    Open Existing Spreadsheet via Google App Script

  14. 14

    Double Clicking an Excel File Will Open Excel but not the Spreadsheet itself

  15. 15

    Open office spreadsheet, export as PDF as single large page?

  16. 16

    Applescript failing to open app in new window

  17. 17

    Sublime running Ruby code can't open a spreadsheet

  18. 18

    Google Spreadsheet: How can I leave the Script Editor open in another tab after refreshing a spreadsheet

  19. 19

    Custom Open Graph Story failing Facebook review

  20. 20

    google spreadsheet json format (How to open)

  21. 21

    I want to open a Link in my google document (no spreadsheet) directely by menu

  22. 22

    Google Script to open URL in same window as Spreadsheet

  23. 23

    VBS script to open excel to call macro failing

  24. 24

    Open Source Web Form Builder With Save to Spreadsheet or Database

  25. 25

    Open CSV File And Go Straight To Spreadsheet

  26. 26

    Open google spreadsheet with .net

  27. 27

    How to open a folder from a list in an Excel spreadsheet using VBA

  28. 28

    Find element byXpath failing when reading from a spreadsheet cell

  29. 29

    FPDF - failing to open eps file?

HotTag

Archive