I tried to list the Pyton API of xlwings. I just trimmed the Official Documents. It wasn't easier to see than I expected. The explanation part will be written in Japanese after translating the formula into Japanese (... of which).
member | Description |
---|---|
xlwings.view(obj,sheet=None) | Opens a new workbook and displays the argument obj on the first sheet by default. If you specify a Sheet object in the argument sheet, the worksheet will be cleared and then obj will be displayed. |
Object model Apps ** Constructor **
member | Description |
---|---|
Apps(impl) | A collection of all app objects: |
** Data attributes **
member | Description |
---|---|
active | Returns the active app. |
count | Returns the number of apps. |
** Method **
member | Description |
---|---|
add() | Creates a new App. The new App becomes the active one. Returns an App object. |
keys() | Returns the PID of the Excel instance. PID is the key to your Apps collection. |
App ** Constructor **
member | Description |
---|---|
App(visible=None, spec=None, add_book=True, impl=None) | An app corresponds to an Excel instance. |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
books | A collection of all Book objects that are currently open. |
calculation | Returns or sets a calculation value that represents the calculation mode. Modes: 'manual', 'automatic', 'semiautomatic' |
display_alerts | The default value is True. Set this property to False to suppress prompts and alert messages while code is running; when a message requires a response, Excel chooses the default response. |
hwnd | ReturnstheWindowhandle(Windows-only). |
pid | Returns the PID of the app. |
screen_updating | Turn screen updating off to speed up your script. You won't be able to see what the script is doing, but it will run faster. Remember to set the screen_updating property back to True when your script ends. |
selection | Returns the selected cells as Range. |
version | Returns the Excel version number object. |
visible | Gets or sets the visibility of Excel to True or False. |
** Method **
member | Description |
---|---|
activate (steal_focus=False) | Activates the Excel app. |
calculate () | Calculates all open books. |
kill() | Forces the Excel app to quit by killing its process. |
macro(name) | Runs a Sub or Function in Excel VBA that are not part of a specific workbook but e.g. are part of an add-in. |
quit() | Quits the application without saving any workbooks. |
range(cell1, cell2=None) | Rangeobjectfromtheactivesheetoftheactivebook,see Range(). |
Books ** Constructor **
member | Description |
---|---|
Books(impl) | A collection of all book objects: |
** Data attributes **
member | Description |
---|---|
active | Returns the active Book. |
** Method **
member | Description |
---|---|
add() | Creates a new Book. The new Book becomes the active Book. Returns a Book object. |
open(fullname, update_links=None, read_only=None, format=None, password=None, write_res_password=None, ignore_read_only_recommended=None, origin=None, delimiter=None, editable=None, notify=None, converter=None, add_to_mru=None, local=None, corrupt_load=None) | Opens a Book if it is not open yet and returns it. If it is already open, it doesn't raise an exception but simply returns the Book object. |
Book ** Constructor **
member | Description |
---|---|
Book(fullname=None, update_links=None, read_only=None, format=None, password=None, write_res_password=None, ignore_read_only_recommended=None, origin=None, delimiter=None, editable=None, notify=None, converter=None, add_to_mru=None, local=None, corrupt_load=None, impl=None) | A book object is a member of the books collection |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
app | Returns an app object that represents the creator of the book. |
fullname | Returns the name of the object, including its path on disk, as a string. Read-only String. |
name | Returns the name of the book as str. |
names | Returnsanamescollectionthatrepresentsallthenamesinthespecifiedbook(includingallsheet-specificnames). |
selection | Returns the selected cells as Range. |
sheets | Returns a sheets collection that represents all the sheets in the book. |
** Method **
member | Description |
---|---|
activate(steal_focus=False) | Activates the book. |
classmethodcaller() | References the calling book when the Python function is called from Excel via RunPython. |
close() | Closes the book without saving it. |
macro(name) | Runs a Sub or Function in Excel VBA. |
staticopen_template() | Creates a new Excel file with the xlwings VBA module already included. This method must be called from an interactive Python shell: |
save(path=None) | SavestheWorkbook.Ifapathisbeingprovided,thisworkslikeSaveAs() in Excel. |
set_mock_caller() | SetstheExcelfilewhichisusedtomock xw.Book.caller() when the code is called from Python and not from Excel via RunPython. |
Sheets ** Constructor **
member | Description |
---|---|
Sheets(impl) | A collection of all sheet objects: |
** Data attributes **
member | Description |
---|---|
active | Returns the active Sheet. |
** Method **
member | Description |
---|---|
add(name=None, before=None, after=None) | Creates a new Sheet and makes it the active sheet. |
Sheet ** Constructor **
member | Description |
---|---|
Sheet(sheet=None, impl=None) | A sheet object is a member of the sheets collection |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
book | Returns the Book of the specified Sheet. Read-only. |
cells | ReturnsaRangeobjectthatrepresentsallthecellsontheSheet(notjustthecellsthatarecurrentlyinuse). |
charts | See Charts |
index | ReturnstheindexoftheSheet(1-basedasinExcel). |
name | Gets or sets the name of the Sheet. |
names | Returnsanamescollectionthatrepresentsallthesheet-specificnames(namesdefinedwiththe"SheetName!"prefix). |
pictures | See Pictures |
shapes | See Shapes |
used_range | Used Range of Sheet. |
** Method **
member | Description |
---|---|
activate() | Activates the Sheet and returns it. |
autofit(axis=None) | Autofits the width of either columns, rows or both on a whole Sheet. |
clear() | Clears the content and formatting of the whole sheet. |
clear_contents() | Clears the content of the whole sheet but leaves the formatting. |
delete() | Deletes the Sheet. |
range(cell1, cell2=None) | ReturnsaRangeobjectfromtheactivesheetoftheactivebook,see Range(). |
select() | Selects the Sheet. Select only works on the active book. |
Range ** Constructor **
member | Description |
---|---|
Range(cell1=None, cell2=None, **options) | Returns a Range object that represents a cell or a range of cells. |
** Data attributes **
member | Description |
---|---|
address | Returnsastringvaluethatrepresentstherangereference.Use get_address() to be able to provide paramaters. |
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
color | Gets and sets the background color of the specified Range. |
column | Returns the number of the first column in the in the specified range. Read-only. |
column_width | Gets or sets the width, in characters, of a Range. |
columns | Returns a RangeColumns object that represents the columns in the specified range. |
count | Returns the number of cells. |
current_region | ThispropertyreturnsaRangeobjectrepresentingarangeboundedby(butnotincluding) any combination of blank rows and blank columns or the edges of the worksheet. |
formula | Gets or sets the formula for the given Range. |
formula_array | Gets or sets an array formula for the given Range. |
height | Returns the height, in points, of a Range. Read-only. |
hyperlink | ReturnsthehyperlinkaddressofthespecifiedRange(singleCellonly) |
last_cell | Returns the bottom right cell of the specified range. Read-only. |
left | Returns the distance, in points, from the left edge of column A to the left edge of the range. Read-only. |
name | Sets or gets the name of a Range. |
number_format | Gets and sets the number_format of a Range. |
raw_value | Getsandsetsthevaluesdirectlyasdeliveredfrom/acceptedbytheenginethatisbeingused(pywin32 or appscript) without going through any of xlwings' data cleaning/converting. |
row | Returns the number of the first row in the specified range. Read-only. |
row_height | Gets or sets the height, in points, of a Range. I |
rows | Returns a RangeRows object that represents the rows in the specified range. |
shape | Tuple of Range dimensions. |
sheet | Returns the Sheet object to which the Range belongs. |
size | Number of elements in the Range. |
top | Returns the distance, in points, from the top edge of row 1 to the top edge of the range. Read-only. |
value | Gets and sets the values for the given Range. |
width | Returns the width, in points, of a Range. Read-only. |
** Method **
member | Description |
---|---|
add_hyperlink(address, text_to_display=None, screen_tip=None) | AddsahyperlinktothespecifiedRange(singleCell) |
autofit() | Autofits the width and height of all cells in the range. |
clear() | Clears the content and the formatting of a Range. |
clear_contents() | Clears the content of a Range but leaves the formatting. |
copy(destination=None) | Copy a range to a destination range or clipboard. |
delete(shift=None) | Deletes a cell or range of cells. |
end(direction) | Returns a Range object that represents the cell at the end of the region that contains the source range. |
expand(mode='table') | Expands the range according to the mode provided. |
get_address(row_absolute=True, column_absolute=True, include_sheetname=False, external=False) | Returns the address of the range in the specified format. |
insert(shift=None, copy_origin='format_from_left_or_above') | Insert a cell or range of cells into the sheet. |
offset(row_offset=0, column_offset=0) | Returns a Range object that represents a Range that's offset from the specified range. |
options(convert=None, **options) | Allows you to set a converter and their options. |
paste(paste=None, operation=None, skip_blanks=False, transpose=False) | Pastes a range from the clipboard into the specified range. |
resize(row_size=None, column_size=None) | Resizes the specified Range |
select() | Selects the range. Select only works on the active book. |
RangeRows ** Constructor **
member | Description |
---|---|
RangeRows(rng) | Represents the rows of a range. Do not construct this class directly, use Range.rows instead. |
** Data attributes **
member | Description |
---|---|
count | Returns the number of rows. |
** Method **
member | Description |
---|---|
autofit() | Autofits the height of the rows. |
RangeColumns ** Constructor **
member | Description |
---|---|
RangeColumns(rng) | Represents the columns of a range. Do not construct this class directly, use Range.columns instead. |
** Data attributes **
member | Description |
---|---|
count | Returns the number of columns. |
** Method **
member | Description |
---|---|
autofit() | Autofits the width of the columns. |
Shapes ** Constructor **
member | Description |
---|---|
Shapes(impl) | A collection of all shape objects on the specified sheet: |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
count | Returns the number of objects in the collection. |
** Method **
member | Description |
---|
Shape ** Constructor **
member | Description |
---|---|
Shape(*args, **options) | The shape object is a member of the shapes collection: |
** Data attributes **
member | Description |
---|---|
height | Returns or sets the number of points that represent the height of the shape. |
left | Returns or sets the number of points that represent the horizontal position of the shape. |
name | Returns or sets the name of the shape. |
parent | Returns the parent of the shape. |
top | Returns or sets the number of points that represent the vertical position of the shape. |
type | Returns the type of the shape. |
width | Returns or sets the number of points that represent the width of the shape. |
** Method **
member | Description |
---|---|
activate() | Activates the shape. |
delete() | Deletes the shape. |
Charts ** Constructor **
member | Description |
---|---|
Charts(impl) | A collection of all chart objects on the specified sheet |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
count | Returns the number of objects in the collection. |
** Method **
member | Description |
---|---|
add(left=0, top=0, width=355, height=211) | Creates a new chart on the specified sheet. |
Chart ** Constructor **
member | Description |
---|---|
Chart(name_or_index=None, impl=None) | The chart object is a member of the charts collection |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
chart_type | Returns and sets the chart type of the chart. |
Deletes the chart. | |
height | Returns or sets the number of points that represent the height of the chart. |
left | Returns or sets the number of points that represent the horizontal position of the chart. |
name | Returns or sets the name of the chart. |
parent | Returns the parent of the chart. |
top | Returns or sets the number of points that represent the vertical position of the chart. |
width | Returns or sets the number of points that represent the width of the chart. |
delete() | Deletes the chart. |
set_source_data(source) | Sets the source data range for the chart. |
Pictures ** Constructor **
member | Description |
---|---|
Pictures(impl) | A collection of all picture objects on the specified sheet |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
count | Returns the number of objects in the collection. |
** Method **
member | Description |
---|---|
add(image, link_to_file=False, save_with_document=True, left=0, top=0, width=None, height=None, name=None, update=False) | Adds a picture to the specified sheet. |
Picture ** Constructor **
member | Description |
---|---|
Picture(impl=None) | The picture object is a member of the pictures collection |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
height | Returns or sets the number of points that represent the height of the picture. |
left | Returns or sets the number of points that represent the horizontal position of the picture. |
name | Returns or sets the name of the picture. |
parent | Returns the parent of the picture. |
top | Returns or sets the number of points that represent the vertical position of the picture. |
width | Returns or sets the number of points that represent the width of the picture. |
** Method **
member | Description |
---|---|
delete() | Deletes the picture. |
update(image) | Replaces an existing picture with a new one, taking over the attributes of the existing picture. |
Names ** Constructor **
member | Description |
---|---|
Names(impl) | A collection of all name objects in the workbook |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
count | Returns the number of objects in the collection. |
** Method **
member | Description |
---|---|
add(name, refers_to) | Defines a new name for a range of cells. |
Name ** Constructor **
member | Description |
---|---|
Name(impl) | The name object is a member of the names collection: |
** Data attributes **
member | Description |
---|---|
api | Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
name | Returns or sets the name of the name object. |
refers_to | Returns or sets the formula that the name is defined to refer to, in A1-style notation, beginning with an equal sign. |
refers_to_range | Returns the Range object referred to by a Name object. |
** Method **
member | Description |
---|---|
delete() | Deletes the name. |
member | Description |
---|---|
xlwings.func(category="xlwings", volatile=False, call_in_wizard=True) | Functions decorated with xlwings.func will be imported as Function to Excel when running "Import Python UDFs". |
xlwings.sub() | Functionsdecoratedwith xlwings.sub willbeimportedas Sub (i.e.macro) to Excel when running "Import Python UDFs". |
xlwings.arg(arg, convert=None, **options) | Applyconvertersandoptionstoarguments,seealso Range.options(). |
xlwings.ret(convert=None, **options) | Applyconvertersandoptionstoreturnvalues,seealso Range.options(). |