@@ -20,6 +20,7 @@ def __init__(
20
20
self .__auto_detect_int = auto_detect_int
21
21
self .__auto_detect_float = auto_detect_float
22
22
self .__auto_detect_datetime = auto_detect_datetime
23
+ self ._native_sheet = sheet
23
24
24
25
def row_iterator (self ):
25
26
return self ._native_sheet .rows ()
@@ -34,16 +35,17 @@ def __convert_cell(self, cell):
34
35
35
36
class XLSBBook (IReader ):
36
37
def __init__ (self , file_name , file_type , ** keywords ):
37
- self ._native_book = open_workbook (self ._file_name )
38
+ self ._native_book = open_workbook (file_name )
39
+ self ._keywords = keywords
38
40
self .content_array = []
39
- for sheet_index , sheet_name in enumerate (self ._native_book .sheets ):
41
+ for sheet_index , sheet_name in enumerate (self ._native_book .sheets , 1 ):
40
42
sheet = self ._native_book .get_sheet (sheet_index )
41
43
self .content_array .append (NamedContent (sheet_name , sheet ))
42
44
43
- def read_sheet_by_index (self , sheet_index ):
44
- sheet = self .content_array [sheet_index ]
45
- return self .read_sheet (sheet )
46
-
47
- def read_sheet (self , native_sheet ):
45
+ def read_sheet (self , sheet_index ):
46
+ native_sheet = self .content_array [sheet_index ].payload
48
47
sheet = XLSBSheet (native_sheet , ** self ._keywords )
49
- return {sheet .name : sheet .to_array ()}
48
+ return sheet
49
+
50
+ def close (self ):
51
+ self ._native_book .close ()
0 commit comments