@@ -136,7 +136,7 @@ Here's the sample code:
136
136
>> > from pyexcel_xlsx import get_data
137
137
>> > data = get_data(" your_file.xlsx" )
138
138
>> > import json
139
- >> > print (json.dumps(data))
139
+ >> > print (json.dumps(data, default = str ))
140
140
{" Sheet 1" : [[1 , 2 , 3 ], [4 , 5 , 6 ]], " Sheet 2" : [[" row 1" , " row 2" , " row 3" ]]}
141
141
142
142
@@ -171,7 +171,7 @@ Continue from previous example:
171
171
>> > # In reality, you might deal with xlsx file upload
172
172
>> > # where you will read from requests.FILES['YOUR_XLSX_FILE']
173
173
>> > data = get_data(io)
174
- >> > print (json.dumps(data))
174
+ >> > print (json.dumps(data, default = str ))
175
175
{" Sheet 1" : [[1 , 2 , 3 ], [4 , 5 , 6 ]], " Sheet 2" : [[7 , 8 , 9 ], [10 , 11 , 12 ]]}
176
176
177
177
@@ -202,15 +202,15 @@ And let's pretend to read partial data:
202
202
.. code-block :: python
203
203
204
204
>> > partial_data = get_data(" huge_file.xlsx" , start_row = 2 , row_limit = 3 )
205
- >> > print (json.dumps(partial_data))
205
+ >> > print (json.dumps(partial_data, default = str ))
206
206
{" huge" : [[3 , 23 , 33 ], [4 , 24 , 34 ], [5 , 25 , 35 ]]}
207
207
208
208
And you could as well do the same for columns:
209
209
210
210
.. code-block :: python
211
211
212
212
>> > partial_data = get_data(" huge_file.xlsx" , start_column = 1 , column_limit = 2 )
213
- >> > print (json.dumps(partial_data))
213
+ >> > print (json.dumps(partial_data, default = str ))
214
214
{" huge" : [[21 , 31 ], [22 , 32 ], [23 , 33 ], [24 , 34 ], [25 , 35 ], [26 , 36 ]]}
215
215
216
216
Obvious, you could do both at the same time:
@@ -220,7 +220,7 @@ Obvious, you could do both at the same time:
220
220
>> > partial_data = get_data(" huge_file.xlsx" ,
221
221
... start_row = 2 , row_limit = 3 ,
222
222
... start_column = 1 , column_limit = 2 )
223
- >> > print (json.dumps(partial_data))
223
+ >> > print (json.dumps(partial_data, default = str ))
224
224
{" huge" : [[23 , 33 ], [24 , 34 ], [25 , 35 ]]}
225
225
226
226
.. testcode ::
0 commit comments