{"id":2028,"date":"2026-04-27T15:51:31","date_gmt":"2026-04-27T07:51:31","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2028"},"modified":"2026-03-28T05:21:48","modified_gmt":"2026-03-28T05:21:48","slug":"how-to-use-applicationaddins2-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationaddins2-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.AddIns2 in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In the Excel object model, the <code>Application.AddIns2<\/code> property returns an <code>AddIns2<\/code> collection that represents all the add-ins currently available to Excel, including both installed add-ins and those that are simply listed in the add-in manager. This collection is more modern than the older <code>AddIns<\/code> collection, as it includes both COM add-ins and automation add-ins. In xlwings, you can access this property to inspect, manage, or manipulate Excel add-ins programmatically using Python. This is particularly useful for automating tasks that involve checking add-in availability, loading or unloading add-ins, or retrieving information about them for administrative or development purposes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The xlwings API provides a straightforward way to interact with the <code>Application.AddIns2<\/code> property. The syntax for accessing it is through the <code>app<\/code> object, which represents the Excel application. Specifically, you can use <code>app.api.AddIns2<\/code> to get the underlying COM object, allowing you to call its methods and properties. The <code>AddIns2<\/code> collection has members such as <code>Count<\/code>, <code>Item<\/code>, and <code>Add<\/code>, which can be used to iterate over add-ins, retrieve specific ones, or install new ones. For example, the <code>Item<\/code> method takes an index (either a numeric position or a string name) to return a specific <code>AddIn<\/code> object. Each <code>AddIn<\/code> object has properties like <code>Name<\/code>, <code>FullName<\/code>, <code>Installed<\/code>, and <code>Path<\/code>, which provide details about the add-in.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To illustrate, here is a simple xlwings code example that lists all available add-ins and their installation status:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Connect to the active Excel instance\napp = xw.apps.active\n\n# Access the AddIns2 collection\naddins2 = app.api.AddIns2\n\n# Print the count of add-ins\nprint(f\"Total add-ins available: {addins2.Count}\")\n\n# Iterate through each add-in and display details\nfor i in range(1, addins2.Count + 1):\n    addin = addins2.Item(i)\n    print(f\"Name: {addin.Name}, Installed: {addin.Installed}, Path: {addin.Path}\")<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Another example demonstrates how to install an add-in using the <code>Add<\/code> method. This method requires the full file path of the add-in file (typically with a <code>.xlam<\/code> or <code>.xll<\/code> extension) and an optional boolean parameter to specify whether to copy the file to the add-in directory. The method returns the <code>AddIn<\/code> object for the newly added add-in, which can then be manipulated further:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\napp = xw.apps.active\naddins2 = app.api.AddIns2\n\n# Add a new add-in from a specified path\naddin_path = r\"C:\\Path\\To\\Your\\AddIn.xlam\"\nnew_addin = addins2.Add(addin_path, True) # True copies the file to the add-in directory\n\n# Check if it's installed and install it if not\nif not new_addin.Installed:\n    new_addin.Installed = True\n    print(f\"Add-in '{new_addin.Name}' has been installed.\")\nelse:\n    print(f\"Add-in '{new_addin.Name}' is already installed.\")<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Excel object model, the `Application.AddIns2` property returns an `AddIns2` collection that r&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-2028","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=2028"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2028\/revisions"}],"predecessor-version":[{"id":3098,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2028\/revisions\/3098"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}