Skip to content

Commit

Permalink
Merge pull request dilshod#277 from SeguridadRX/fix-no-workbook-relat…
Browse files Browse the repository at this point in the history
…ionship

Fix bug when missing workbook relationship
  • Loading branch information
dilshod authored Mar 18, 2024
2 parents f2a429a + ef3ff50 commit b45eb09
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions xlsx2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,11 @@ def __init__(self, xlsxfile, **options):
self.shared_strings = self._parse(SharedStrings, self.content_types.types["shared_strings"])
self.styles = self._parse(Styles, self.content_types.types["styles"])
self.workbook = self._parse(Workbook, self.content_types.types["workbook"])
workbook_relationships = list(filter(lambda r: "book" in r, self.content_types.types["relationships"]))[0]
self.workbook.relationships = self._parse(Relationships, workbook_relationships)
workbook_relationships = list(filter(lambda r: "book" in r, self.content_types.types["relationships"]))
if len(workbook_relationships) > 0:
self.workbook.relationships = self._parse(Relationships, workbook_relationships[0])
else:
self.workbook.relationships = Relationships()
if self.options['no_line_breaks']:
self.shared_strings.replace_line_breaks()
elif self.options['escape_strings']:
Expand Down

0 comments on commit b45eb09

Please sign in to comment.