Skip to content

Commit

Permalink
openpyxl is required for xlsx
Browse files Browse the repository at this point in the history
  • Loading branch information
bmihelac committed Dec 18, 2015
1 parent 0d5c61e commit 35426b9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions import_export/formats/base_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@


try:
from tablib.compat import openpyxl

import openpyxl
XLSX_IMPORT = True
except ImportError:
try:
import openpyxl # NOQA

XLSX_IMPORT = True
from tablib.compat import openpyxl
XLSX_IMPORT = hasattr(openpyxl, 'load_workbook')
except ImportError:
xlsx_warning = "Installed `tablib` library does not include"
"import support for 'xlsx' format and openpyxl module is not found."
Expand Down Expand Up @@ -211,8 +209,7 @@ def create_dataset(self, in_stream):
"""
assert XLSX_IMPORT
from io import BytesIO
from openpyxl import load_workbook
xlsx_book = load_workbook(BytesIO(in_stream))
xlsx_book = openpyxl.load_workbook(BytesIO(in_stream))

dataset = tablib.Dataset()
sheet = xlsx_book.active
Expand Down

0 comments on commit 35426b9

Please sign in to comment.