J'ai essayé de lister l'API Pyton de xlwings. Je viens de couper les Documents officiels. Ce n'était pas plus facile à voir que ce à quoi je m'attendais.
La partie explication sera écrite en japonais après traduction de la formule en japonais (... dont).
Top-level functions
membre |
La description |
xlwings.view(obj,sheet=None) |
Ouvre un nouveau classeur et affiche l'argument obj sur la première feuille par défaut. Si vous spécifiez un objet Sheet dans la feuille d'arguments, la feuille de calcul sera effacée et obj sera affiché. |
Object model
Apps
** Constructeur **
membre |
La description |
Apps(impl) |
A collection of all app objects: |
** Attributs de données **
membre |
La description |
active |
Returns the active app. |
count |
Returns the number of apps. |
** Méthode **
membre |
La description |
add() |
Creates a new App. The new App becomes the active one. Returns an App object. |
keys() |
Renvoie le PID de l'instance Excel. Le PID est la clé de la collection Apps. |
App
** Constructeur **
membre |
La description |
App(visible=None, spec=None, add_book=True, impl=None) |
An app corresponds to an Excel instance. |
** Attributs de données **
membre |
La 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. |
** Méthode **
membre |
La 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
** Constructeur **
membre |
La description |
Books(impl) |
A collection of all book objects: |
** Attributs de données **
membre |
La description |
active |
Returns the active Book. |
** Méthode **
membre |
La 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
** Constructeur **
membre |
La 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 |
** Attributs de données **
membre |
La 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. |
** Méthode **
membre |
La 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
** Constructeur **
membre |
La description |
Sheets(impl) |
A collection of all sheet objects: |
** Attributs de données **
membre |
La description |
active |
Returns the active Sheet. |
** Méthode **
Sheet
** Constructeur **
** Attributs de données **
membre |
La 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. |
** Méthode **
membre |
La 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
** Constructeur **
** Attributs de données **
membre |
La 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. |
** Méthode **
membre |
La 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
** Constructeur **
membre |
La description |
RangeRows(rng) |
Represents the rows of a range. Do not construct this class directly, use Range.rows instead. |
** Attributs de données **
membre |
La description |
count |
Returns the number of rows. |
** Méthode **
membre |
La description |
autofit() |
Autofits the height of the rows. |
RangeColumns
** Constructeur **
membre |
La description |
RangeColumns(rng) |
Represents the columns of a range. Do not construct this class directly, use Range.columns instead. |
** Attributs de données **
membre |
La description |
count |
Returns the number of columns. |
** Méthode **
membre |
La description |
autofit() |
Autofits the width of the columns. |
Shapes
** Constructeur **
membre |
La description |
Shapes(impl) |
A collection of all shape objects on the specified sheet: |
** Attributs de données **
membre |
La description |
api |
Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
count |
Returns the number of objects in the collection. |
** Méthode **
Shape
** Constructeur **
** Attributs de données **
membre |
La 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. |
** Méthode **
Charts
** Constructeur **
membre |
La description |
Charts(impl) |
A collection of all chart objects on the specified sheet |
** Attributs de données **
membre |
La description |
api |
Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
count |
Returns the number of objects in the collection. |
** Méthode **
membre |
La description |
add(left=0, top=0, width=355, height=211) |
Creates a new chart on the specified sheet. |
Chart
** Constructeur **
** Attributs de données **
membre |
La 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
** Constructeur **
membre |
La description |
Pictures(impl) |
A collection of all picture objects on the specified sheet |
** Attributs de données **
membre |
La description |
api |
Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
count |
Returns the number of objects in the collection. |
** Méthode **
Picture
** Constructeur **
membre |
La description |
Picture(impl=None) |
The picture object is a member of the pictures collection |
** Attributs de données **
membre |
La 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. |
** Méthode **
membre |
La description |
delete() |
Deletes the picture. |
update(image) |
Replaces an existing picture with a new one, taking over the attributes of the existing picture. |
Names
** Constructeur **
membre |
La description |
Names(impl) |
A collection of all name objects in the workbook |
** Attributs de données **
membre |
La description |
api |
Returnsthenativeobject(pywin32 or appscript obj) of the engine being used. |
count |
Returns the number of objects in the collection. |
** Méthode **
Name
** Constructeur **
membre |
La description |
Name(impl) |
The name object is a member of the names collection: |
** Attributs de données **
membre |
La 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. |
** Méthode **
membre |
La description |
delete() |
Deletes the name. |
UDF decorators