Top-level functions¶
- load(index=1, header=1, chunksize=5000)¶
Loads the selected cell(s) of the active workbook into a pandas DataFrame. If you select a single cell that has adjacent cells, the range is auto-expanded (via current region) and turned into a pandas DataFrame. If you don’t have pandas installed, it returns the values as nested lists.
Note
Only use this in an interactive context like e.g. a Jupyter notebook! Don’t use this in a script as it depends on the active book.
Parameters¶
- indexbool or int, default 1
Defines the number of columns on the left that will be turned into the DataFrame’s index
- headerbool or int, default 1
Defines the number of rows at the top that will be turned into the DataFrame’s columns
- chunksizeint, default 5000
Chunks the loading of big arrays.
Examples¶
>>> import xlwings as xw >>> xw.load()
See also:
view
Changed in version 0.23.1.
- view(obj, sheet=None, table=True, chunksize=5000)¶
Opens a new workbook and displays an object on its first sheet by default. If you provide a sheet object, it will clear the sheet before displaying the object on the existing sheet.
Note
Only use this in an interactive context like e.g., a Jupyter notebook! Don’t use this in a script as it depends on the active book.
Parameters¶
- objany type with built-in converter
the object to display, e.g. numbers, strings, lists, numpy arrays, pandas DataFrames
- sheetSheet, default None
Sheet object. If none provided, the first sheet of a new workbook is used.
- tablebool, default True
If your object is a pandas DataFrame, by default it is formatted as an Excel Table
- chunksizeint, default 5000
Chunks the loading of big arrays.
Examples¶
>>> import xlwings as xw >>> import pandas as pd >>> import numpy as np >>> df = pd.DataFrame(np.random.rand(10, 4), columns=['a', 'b', 'c', 'd']) >>> xw.view(df)
See also:
load
Changed in version 0.22.0.