Skip to content

Commit fcbe9a8

Browse files
committed
update pyexcel-io version
2 parents 61261d3 + 0e921f8 commit fcbe9a8

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ Write to an xls file
6666

6767
Here's the sample code to write a dictionary to an xls file::
6868

69-
>>> from pyexcel_xls import store_data
69+
>>> from pyexcel_xls import save_data
7070
>>> data = OrderedDict() # from collections import OrderedDict
7171
>>> data.update({"Sheet 1": [[1, 2, 3], [4, 5, 6]]})
7272
>>> data.update({"Sheet 2": [["row 1", "row 2", "row 3"]]})
73-
>>> store_data("your_file.xls", data)
73+
>>> save_data("your_file.xls", data)
7474

7575
Read from an xls file
7676
**********************
7777

7878
Here's the sample code::
7979

80-
>>> from pyexcel_xls import load_data
81-
>>> data = load_data("your_file.xls")
80+
>>> from pyexcel_xls import get_data
81+
>>> data = get_data("your_file.xls")
8282
>>> import json
8383
>>> print(json.dumps(data))
8484
{"Sheet 1": [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], "Sheet 2": [["row 1", "row 2", "row 3"]]}
@@ -88,7 +88,7 @@ Write an xls to memory
8888

8989
Here's the sample code to write a dictionary to an xls file::
9090

91-
>>> from pyexcel_xls import store_data
91+
>>> from pyexcel_xls import save_data
9292
>>> data = OrderedDict()
9393
>>> data.update({"Sheet 1": [[1, 2, 3], [4, 5, 6]]})
9494
>>> data.update({"Sheet 2": [[7, 8, 9], [10, 11, 12]]})
@@ -107,7 +107,7 @@ Continue from previous example::
107107
>>> # This is just an illustration
108108
>>> # In reality, you might deal with xls file upload
109109
>>> # where you will read from requests.FILES['YOUR_XL_FILE']
110-
>>> data = load_data(io)
110+
>>> data = get_data(io)
111111
>>> print(json.dumps(data))
112112
{"Sheet 1": [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]], "Sheet 2": [[7.0, 8.0, 9.0], [10.0, 11.0, 12.0]]}
113113

pyexcel_xls/__init__.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
READERS,
2020
WRITERS,
2121
isstream,
22+
is_string,
2223
load_data as read_data,
2324
store_data as write_data
2425
)
@@ -216,33 +217,23 @@ def close(self):
216217
"xlsm": XLBook,
217218
"xlsx": XLBook
218219
})
220+
221+
219222
WRITERS.update({
220223
"xls": XLWriter
221224
})
222225

223226

224-
def is_string(atype):
225-
"""find out if a type is str or not"""
226-
if atype == str:
227-
return True
228-
elif PY2:
229-
if atype == unicode:
230-
return True
231-
elif atype == str:
232-
return True
233-
return False
234-
235-
236-
def store_data(afile, data, file_type=None, **keywords):
227+
def get_data(afile, file_type=None, **keywords):
237228
if isstream(afile) and file_type is None:
238229
file_type='xls'
239-
write_data(afile, data, file_type=file_type, **keywords)
230+
return read_data(afile, file_type=file_type, **keywords)
240231

241232

242-
def load_data(afile, file_type=None, **keywords):
233+
def save_data(afile, data, file_type=None, **keywords):
243234
if isstream(afile) and file_type is None:
244235
file_type='xls'
245-
return read_data(afile, file_type=file_type, **keywords)
236+
write_data(afile, data, file_type=file_type, **keywords)
246237

247238

248239
__VERSION__ = "0.0.7"

0 commit comments

Comments
 (0)