[PYTHON] xlwings API-Referenzliste

Ich habe versucht, die Pyton-API von xlwings aufzulisten. Ich habe gerade die [offiziellen Dokumente] gekürzt (https://docs.xlwings.org/ja/latest/api.html). Es war nicht einfacher zu sehen als ich erwartet hatte. Der Erklärungsteil wird auf Japanisch geschrieben, nachdem die Formel ins Japanische übersetzt wurde (... davon).

Top-level functions

Mitglied Erläuterung
xlwings.view(obj,sheet=None) Öffnet eine neue Arbeitsmappe und zeigt standardmäßig das Argument obj auf dem ersten Blatt an. Wenn Sie im Argumentblatt ein Sheet-Objekt angeben, wird das Arbeitsblatt gelöscht und anschließend obj angezeigt.

Object model Apps ** Konstrukteur **

Mitglied Erläuterung
Apps(impl) A collection of all app objects:

** Datenattribute **

Mitglied Erläuterung
active Returns the active app.
count Returns the number of apps.

** Methode **

Mitglied Erläuterung
add() Creates a new App. The new App becomes the active one. Returns an App object.
keys() Gibt die PID der Excel-Instanz zurück. Die PID ist der Schlüssel zur Apps-Sammlung.

App ** Konstrukteur **

Mitglied Erläuterung
App(visible=None, spec=None, add_book=True, impl=None) An app corresponds to an Excel instance.

** Datenattribute **

Mitglied Erläuterung
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.

** Methode **

Mitglied Erläuterung
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 ** Konstrukteur **

Mitglied Erläuterung
Books(impl) A collection of all book objects:

** Datenattribute **

Mitglied Erläuterung
active Returns the active Book.

** Methode **

Mitglied Erläuterung
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 ** Konstrukteur **

Mitglied Erläuterung
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

** Datenattribute **

Mitglied Erläuterung
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.

** Methode **

Mitglied Erläuterung
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 ** Konstrukteur **

Mitglied Erläuterung
Sheets(impl) A collection of all sheet objects:

** Datenattribute **

Mitglied Erläuterung
active Returns the active Sheet.

** Methode **

Mitglied Erläuterung
add(name=None, before=None, after=None) Creates a new Sheet and makes it the active sheet.

Sheet ** Konstrukteur **

Mitglied Erläuterung
Sheet(sheet=None, impl=None) A sheet object is a member of the sheets collection

** Datenattribute **

Mitglied Erläuterung
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.

** Methode **

Mitglied Erläuterung
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 ** Konstrukteur **

Mitglied Erläuterung
Range(cell1=None, cell2=None, **options) Returns a Range object that represents a cell or a range of cells.

** Datenattribute **

Mitglied Erläuterung
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.

** Methode **

Mitglied Erläuterung
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 ** Konstrukteur **

Mitglied Erläuterung
RangeRows(rng) Represents the rows of a range. Do not construct this class directly, use Range.rows instead.

** Datenattribute **

Mitglied Erläuterung
count Returns the number of rows.

** Methode **

Mitglied Erläuterung
autofit() Autofits the height of the rows.

RangeColumns ** Konstrukteur **

Mitglied Erläuterung
RangeColumns(rng) Represents the columns of a range. Do not construct this class directly, use Range.columns instead.

** Datenattribute **

Mitglied Erläuterung
count Returns the number of columns.

** Methode **

Mitglied Erläuterung
autofit() Autofits the width of the columns.

Shapes ** Konstrukteur **

Mitglied Erläuterung
Shapes(impl) A collection of all shape objects on the specified sheet:

** Datenattribute **

Mitglied Erläuterung
api Returnsthenativeobject(pywin32 or appscript obj) of the engine being used.
count Returns the number of objects in the collection.

** Methode **

Mitglied Erläuterung

Shape ** Konstrukteur **

Mitglied Erläuterung
Shape(*args, **options) The shape object is a member of the shapes collection:

** Datenattribute **

Mitglied Erläuterung
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.

** Methode **

Mitglied Erläuterung
activate() Activates the shape.
delete() Deletes the shape.

Charts ** Konstrukteur **

Mitglied Erläuterung
Charts(impl) A collection of all chart objects on the specified sheet

** Datenattribute **

Mitglied Erläuterung
api Returnsthenativeobject(pywin32 or appscript obj) of the engine being used.
count Returns the number of objects in the collection.

** Methode **

Mitglied Erläuterung
add(left=0, top=0, width=355, height=211) Creates a new chart on the specified sheet.

Chart ** Konstrukteur **

Mitglied Erläuterung
Chart(name_or_index=None, impl=None) The chart object is a member of the charts collection

** Datenattribute **

Mitglied Erläuterung
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 ** Konstrukteur **

Mitglied Erläuterung
Pictures(impl) A collection of all picture objects on the specified sheet

** Datenattribute **

Mitglied Erläuterung
api Returnsthenativeobject(pywin32 or appscript obj) of the engine being used.
count Returns the number of objects in the collection.

** Methode **

Mitglied Erläuterung
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 ** Konstrukteur **

Mitglied Erläuterung
Picture(impl=None) The picture object is a member of the pictures collection

** Datenattribute **

Mitglied Erläuterung
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.

** Methode **

Mitglied Erläuterung
delete() Deletes the picture.
update(image) Replaces an existing picture with a new one, taking over the attributes of the existing picture.

Names ** Konstrukteur **

Mitglied Erläuterung
Names(impl) A collection of all name objects in the workbook

** Datenattribute **

Mitglied Erläuterung
api Returnsthenativeobject(pywin32 or appscript obj) of the engine being used.
count Returns the number of objects in the collection.

** Methode **

Mitglied Erläuterung
add(name, refers_to) Defines a new name for a range of cells.

Name ** Konstrukteur **

Mitglied Erläuterung
Name(impl) The name object is a member of the names collection:

** Datenattribute **

Mitglied Erläuterung
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.

** Methode **

Mitglied Erläuterung
delete() Deletes the name.

UDF decorators

Mitglied Erläuterung
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().

Recommended Posts

xlwings API-Referenzliste
Quantopian API-Referenz
Liste der Python-APIs für OpenCV3