pyexcel.Sheet.project

Sheet.project(new_ordered_columns, exclusion=False)[source]

Rearrange the sheet.

Variables:
  • new_ordered_columns – new columns
  • exclusion – to exlucde named column or not. defaults to False

Example:

>>> sheet = Sheet(
... [["A", "B", "C"], [1, 2, 3], [11, 22, 33], [111, 222, 333]],
... name_columns_by_row=0)
>>> sheet.project(["B", "A", "C"])
pyexcel sheet:
+-----+-----+-----+
|  B  |  A  |  C  |
+=====+=====+=====+
| 2   | 1   | 3   |
+-----+-----+-----+
| 22  | 11  | 33  |
+-----+-----+-----+
| 222 | 111 | 333 |
+-----+-----+-----+
>>> sheet.project(["B", "C"])
pyexcel sheet:
+-----+-----+
|  B  |  C  |
+=====+=====+
| 2   | 3   |
+-----+-----+
| 22  | 33  |
+-----+-----+
| 222 | 333 |
+-----+-----+
>>> sheet.project(["B", "C"], exclusion=True)
pyexcel sheet:
+-----+
|  A  |
+=====+
| 1   |
+-----+
| 11  |
+-----+
| 111 |
+-----+