~ubuntu-branches/ubuntu/wily/openpyxl/wily-proposed

« back to all changes in this revision

Viewing changes to openpyxl/reader/excel.py

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2011-11-18 15:56:52 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20111118155652-bsxf6i5wq4ptg2ln
Tags: 1.5.6-1
Fresh upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# file openpyxl/reader/excel.py
2
2
 
3
 
# Copyright (c) 2010 openpyxl
 
3
# Copyright (c) 2010-2011 openpyxl
4
4
#
5
5
# Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
# of this software and associated documentation files (the "Software"), to deal
21
21
# THE SOFTWARE.
22
22
#
23
23
# @license: http://www.opensource.org/licenses/mit-license.php
24
 
# @author: Eric Gazoni
 
24
# @author: see AUTHORS file
25
25
 
26
26
"""Read an xlsx file into Python"""
27
27
 
40
40
from openpyxl.reader.worksheet import read_worksheet
41
41
from openpyxl.reader.iter_worksheet import unpack_worksheet
42
42
 
43
 
def load_workbook(filename, use_iterators = False):
 
43
def load_workbook(filename, use_iterators=False):
44
44
    """Open the given filename and return the workbook
45
45
 
46
46
    :param filename: the path to open
77
77
        _load_workbook(wb, archive, filename, use_iterators)
78
78
    except KeyError, e:
79
79
        raise InvalidFileException(unicode(e))
80
 
    finally:
81
 
        archive.close()
 
80
 
 
81
    archive.close()
82
82
    return wb
83
83
 
84
84
def _load_workbook(wb, archive, filename, use_iterators):
90
90
        wb.properties = read_properties_core(archive.read(ARC_CORE))
91
91
    except KeyError:
92
92
        wb.properties = DocumentProperties()
93
 
    
 
93
 
94
94
    try:
95
95
        string_table = read_string_table(archive.read(ARC_SHARED_STRINGS))
96
96
    except KeyError:
113
113
        else:
114
114
            xml_source = unpack_worksheet(archive, worksheet_path)
115
115
            new_ws = read_worksheet(xml_source, wb, sheet_name, string_table, style_table, filename, sheet_codename)
116
 
            #new_ws = read_worksheet(archive.read(worksheet_path), wb, sheet_name, string_table, style_table, filename, sheet_codename)
117
 
        wb.add_sheet(new_ws, index = i)
 
116
        wb.add_sheet(new_ws, index=i)
118
117
 
119
118
    wb._named_ranges = read_named_ranges(archive.read(ARC_WORKBOOK), wb)