diff --git a/README.rst b/README.rst index f2a075c..2bbdaaf 100644 --- a/README.rst +++ b/README.rst @@ -121,6 +121,51 @@ Continue from previous example: {"Sheet 1": [[1, 2, 3], [4, 5, 6]], "Sheet 2": [[7, 8, 9], [10, 11, 12]]} +Pagination feature +******************************************************************************** + +Let's assume the following file is a huge xls file: + + >>> huge_data = [ + ... [1, 21, 31], + ... [2, 22, 32], + ... [3, 23, 33], + ... [4, 24, 34], + ... [5, 25, 35], + ... [6, 26, 36] + ... ] + >>> sheetx = { + ... "huge": huge_data + ... } + >>> save_data("huge_file.xls", sheetx) + +And let's pretend to read partial data: + +.. code-block:: python + + >>> partial_data = get_data("huge_file.xls", start_row=2, row_limit=3) + >>> partial_data['huge'] + [[3, 23, 33], [4, 24, 34], [5, 25, 35]] + +And you could as well do the same for columns: + +.. code-block:: python + + >>> partial_data = get_data("huge_file.xls", start_column=1, column_limit=2) + >>> partial_data['huge'] + [[21, 31], [22, 32], [23, 33], [24, 34], [25, 35], [26, 36]] + +Obvious, you could do both at the same time: + +.. code-block:: python + + >>> partial_data = get_data("huge_file.xls", + ... start_row=2, row_limit=3) + ... start_column=1, column_limit=2) + >>> partial_data['huge'] + [[3, 23, 33], [4, 24, 34], [5, 25, 35]] + + As a pyexcel plugin -------------------------------------------------------------------------------- @@ -278,4 +323,5 @@ Known Issues >>> import os >>> os.unlink("your_file.xls") + >>> os.unlink("huge_file.xls") >>> os.unlink("another_file.xls") diff --git a/test.bat b/test.bat index dee6ea0..00c3550 100644 --- a/test.bat +++ b/test.bat @@ -1,3 +1,3 @@ pip freeze -nosetests --with-cov --cover-package pyexcel_xls --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_xls && flake8 . --exclude=.moban.d +nosetests --with-cov --cover-package pyexcel_xls --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_xls && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long diff --git a/test.sh b/test.sh index dee6ea0..00c3550 100644 --- a/test.sh +++ b/test.sh @@ -1,3 +1,3 @@ pip freeze -nosetests --with-cov --cover-package pyexcel_xls --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_xls && flake8 . --exclude=.moban.d +nosetests --with-cov --cover-package pyexcel_xls --cover-package tests --with-doctest --doctest-extension=.rst tests README.rst pyexcel_xls && flake8 . --exclude=.moban.d --builtins=unicode,xrange,long