pyexcel.Sheet.region

Sheet.region(topleft_corner, bottomright_corner)

Get a rectangle shaped data out

Parameters:
  • topleft_corner (slice) – the top left corner of the rectangle
  • bottomright_corner (slice) – the bottom right corner of the rectangle

example:

>>> import pyexcel as pe
>>> data = [
...     # 0 1  2  3  4 5   6
...     [1, 2, 3, 4, 5, 6, 7], #  0
...     [21, 22, 23, 24, 25, 26, 27],
...     [31, 32, 33, 34, 35, 36, 37],
...     [41, 42, 43, 44, 45, 46, 47],
...     [51, 52, 53, 54, 55, 56, 57]  # 4
... ]
>>> s = pe.Sheet(data)
>>> data = s.cut([1, 1], [4, 5])
>>> s2 = pe.Sheet(data) #  let's present the result
>>> s2
Sheet Name: pyexcel
+----+----+----+----+
| 22 | 23 | 24 | 25 |
+----+----+----+----+
| 32 | 33 | 34 | 35 |
+----+----+----+----+
| 42 | 43 | 44 | 45 |
+----+----+----+----+