1
1
================================================================================
2
- - Let you focus on data, instead of format
2
+ pyexcel-odsr - Let you focus on data, instead of ods format
3
3
================================================================================
4
4
5
5
.. image :: https://raw.githubusercontent.com/pyexcel/pyexcel.github.io/master/images/patreon.png
8
8
.. image :: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg
9
9
:target: https://awesome-python.com/#specific-formats-processing
10
10
11
- .. image :: https://travis-ci.org// .svg?branch=
12
- :target: http://travis-ci.org//
11
+ .. image :: https://travis-ci.org/pyexcel/pyexcel-odsr .svg?branch=master
12
+ :target: http://travis-ci.org/pyexcel/pyexcel-odsr
13
13
14
- .. image :: https://codecov.io/gh// /branch/master/graph/badge.svg
15
- :target: https://codecov.io/gh//
14
+ .. image :: https://codecov.io/gh/pyexcel/pyexcel-odsr /branch/master/graph/badge.svg
15
+ :target: https://codecov.io/gh/pyexcel/pyexcel-odsr
16
16
17
- .. image :: https://badge.fury.io/py/.svg
18
- :target: https://pypi.org/project/
17
+ .. image :: https://badge.fury.io/py/pyexcel-odsr .svg
18
+ :target: https://pypi.org/project/pyexcel-odsr
19
19
20
20
21
- .. image :: https://pepy.tech/badge//month
22
- :target: https://pepy.tech/project//month
21
+ .. image :: https://pepy.tech/badge/pyexcel-odsr /month
22
+ :target: https://pepy.tech/project/pyexcel-odsr /month
23
23
24
24
25
25
.. image :: https://img.shields.io/gitter/room/gitterHQ/gitter.svg
@@ -66,19 +66,19 @@ Installation
66
66
================================================================================
67
67
68
68
69
- You can install via pip:
69
+ You can install pyexcel-odsr via pip:
70
70
71
71
.. code-block :: bash
72
72
73
- $ pip install
73
+ $ pip install pyexcel-odsr
74
74
75
75
76
76
or clone it and install it:
77
77
78
78
.. code-block :: bash
79
79
80
- $ git clone https://github.com// .git
81
- $ cd
80
+ $ git clone https://github.com/pyexcel/pyexcel-odsr .git
81
+ $ cd pyexcel-odsr
82
82
$ python setup.py install
83
83
84
84
Usage
@@ -110,18 +110,18 @@ As a standalone library
110
110
>>> data = OrderedDict() # from collections import OrderedDict
111
111
>>> data.update({" Sheet 1" : [[1 , 2 , 3 ], [4 , 5 , 6 ]]})
112
112
>>> data.update({" Sheet 2" : [[" row 1" , " row 2" , " row 3" ]]})
113
- >>> save_data(" your_file." , data)
113
+ >>> save_data(" your_file.ods " , data)
114
114
115
115
116
- Read from an file
116
+ Read from an ods file
117
117
********************************************************************************
118
118
119
119
Here's the sample code:
120
120
121
121
.. code-block :: python
122
122
123
- >> > from pyexcel_ import get_data
124
- >> > data = get_data(" your_file." )
123
+ >> > from pyexcel_odsr import get_data
124
+ >> > data = get_data(" your_file.ods " )
125
125
>> > import json
126
126
>> > print (json.dumps(data))
127
127
{" Sheet 1" : [[1 , 2 , 3 ], [4 , 5 , 6 ]], " Sheet 2" : [[" row 1" , " row 2" , " row 3" ]]}
@@ -144,16 +144,16 @@ Here's the sample code:
144
144
145
145
146
146
147
- Read from an from memory
147
+ Read from an ods from memory
148
148
********************************************************************************
149
149
150
150
Continue from previous example:
151
151
152
152
.. code-block :: python
153
153
154
154
>> > # This is just an illustration
155
- >> > # In reality, you might deal with file upload
156
- >> > # where you will read from requests.FILES['YOUR__FILE ']
155
+ >> > # In reality, you might deal with ods file upload
156
+ >> > # where you will read from requests.FILES['YOUR_ODS_FILE ']
157
157
>> > data = get_data(io)
158
158
>> > print (json.dumps(data))
159
159
{" Sheet 1" : [[1 , 2 , 3 ], [4 , 5 , 6 ]], " Sheet 2" : [[7 , 8 , 9 ], [10 , 11 , 12 ]]}
@@ -164,7 +164,7 @@ Pagination feature
164
164
165
165
166
166
167
- Let's assume the following file is a huge file:
167
+ Let's assume the following file is a huge ods file:
168
168
169
169
.. code-block :: python
170
170
@@ -179,29 +179,29 @@ Let's assume the following file is a huge file:
179
179
>> > sheetx = {
180
180
... " huge" : huge_data
181
181
... }
182
- >> > save_data(" huge_file." , sheetx)
182
+ >> > save_data(" huge_file.ods " , sheetx)
183
183
184
184
And let's pretend to read partial data:
185
185
186
186
.. code-block :: python
187
187
188
- >> > partial_data = get_data(" huge_file." , start_row = 2 , row_limit = 3 )
188
+ >> > partial_data = get_data(" huge_file.ods " , start_row = 2 , row_limit = 3 )
189
189
>> > print (json.dumps(partial_data))
190
190
{" huge" : [[3 , 23 , 33 ], [4 , 24 , 34 ], [5 , 25 , 35 ]]}
191
191
192
192
And you could as well do the same for columns:
193
193
194
194
.. code-block :: python
195
195
196
- >> > partial_data = get_data(" huge_file." , start_column = 1 , column_limit = 2 )
196
+ >> > partial_data = get_data(" huge_file.ods " , start_column = 1 , column_limit = 2 )
197
197
>> > print (json.dumps(partial_data))
198
198
{" huge" : [[21 , 31 ], [22 , 32 ], [23 , 33 ], [24 , 34 ], [25 , 35 ], [26 , 36 ]]}
199
199
200
200
Obvious, you could do both at the same time:
201
201
202
202
.. code-block :: python
203
203
204
- >> > partial_data = get_data(" huge_file." ,
204
+ >> > partial_data = get_data(" huge_file.ods " ,
205
205
... start_row = 2 , row_limit = 3 ,
206
206
... start_column = 1 , column_limit = 2 )
207
207
>> > print (json.dumps(partial_data))
@@ -210,26 +210,26 @@ Obvious, you could do both at the same time:
210
210
.. testcode ::
211
211
:hide:
212
212
213
- >>> os.unlink(" huge_file." )
213
+ >>> os.unlink(" huge_file.ods " )
214
214
215
215
216
216
As a pyexcel plugin
217
217
--------------------------------------------------------------------------------
218
218
219
219
No longer, explicit import is needed since pyexcel version 0.2.2. Instead,
220
- this library is auto-loaded. So if you want to read data in format,
220
+ this library is auto-loaded. So if you want to read data in ods format,
221
221
installing it is enough.
222
222
223
223
224
- Reading from an file
224
+ Reading from an ods file
225
225
********************************************************************************
226
226
227
227
Here is the sample code:
228
228
229
229
.. code-block :: python
230
230
231
231
>> > import pyexcel as pe
232
- >> > sheet = pe.get_book(file_name = " your_file." )
232
+ >> > sheet = pe.get_book(file_name = " your_file.ods " )
233
233
>> > sheet
234
234
Sheet 1 :
235
235
+ -- -+ -- -+ -- -+
@@ -247,24 +247,24 @@ Here is the sample code:
247
247
.. testcode ::
248
248
:hide:
249
249
250
- >>> sheet.save_as(" another_file." )
250
+ >>> sheet.save_as(" another_file.ods " )
251
251
252
252
253
253
254
254
Reading from a IO instance
255
255
********************************************************************************
256
256
257
- You got to wrap the binary content with stream to get working:
257
+ You got to wrap the binary content with stream to get ods working:
258
258
259
259
.. code-block :: python
260
260
261
261
>> > # This is just an illustration
262
- >> > # In reality, you might deal with file upload
263
- >> > # where you will read from requests.FILES['YOUR__FILE ']
264
- >> > file = " another_file."
265
- >> > with open (file , " rb" ) as f:
262
+ >> > # In reality, you might deal with ods file upload
263
+ >> > # where you will read from requests.FILES['YOUR_ODS_FILE ']
264
+ >> > odsfile = " another_file.ods "
265
+ >> > with open (odsfile , " rb" ) as f:
266
266
... content = f.read()
267
- ... r = pe.get_book(file_type = " " , file_content = content)
267
+ ... r = pe.get_book(file_type = " ods " , file_content = content)
268
268
... print (r)
269
269
...
270
270
Sheet 1 :
@@ -284,15 +284,15 @@ You got to wrap the binary content with stream to get working:
284
284
License
285
285
================================================================================
286
286
287
- License
287
+ New BSD License
288
288
289
289
Developer guide
290
290
==================
291
291
292
292
Development steps for code changes
293
293
294
- #. git clone https://github.com/pyexcel/.git
295
- #. cd
294
+ #. git clone https://github.com/pyexcel/pyexcel-odsr .git
295
+ #. cd pyexcel-odsr
296
296
297
297
Upgrade your setup tools and pip. They are needed for development and testing only:
298
298
@@ -349,5 +349,5 @@ This library is based on the ods of messytables, Open Knowledge Foundation Ltd.
349
349
:hide:
350
350
351
351
>>> import os
352
- >>> os.unlink(" your_file." )
353
- >>> os.unlink(" another_file." )
352
+ >>> os.unlink(" your_file.ods " )
353
+ >>> os.unlink(" another_file.ods " )
0 commit comments