{"id":2107,"date":"2026-06-06T07:31:01","date_gmt":"2026-06-05T23:31:01","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2107"},"modified":"2026-03-28T07:07:03","modified_gmt":"2026-03-28T07:07:03","slug":"how-to-use-applicationextendlist-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationextendlist-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.ExtendList in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <code>Application.ExtendList<\/code> property in Excel is a read-only Boolean property that indicates whether the &#8220;Extend list formats and formulas&#8221; option is enabled in Excel&#8217;s AutoCorrect settings. This setting, when turned on, automatically extends formatting and formulas when new data is added to a list, facilitating consistent data entry and calculation in structured ranges like tables. In xlwings, this property can be accessed through the <code>api<\/code> property of the <code>App<\/code> object, allowing Python scripts to check the current state of this Excel feature programmatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Functionality:<\/strong><br>The primary function of <code>ExtendList<\/code> is to inform whether Excel is configured to automatically apply existing formats and formulas to new rows or columns added to a list. This is particularly useful in scenarios involving dynamic data ranges where maintaining uniformity is critical. By querying this property, developers can decide whether to rely on Excel&#8217;s built-in automation or implement custom logic for data expansion in their scripts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax in xlwings:<\/strong><br>The property is accessed via the <code>api<\/code> interface, which mirrors Excel&#8217;s VBA object model. The syntax is straightforward:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app.api.ExtendList<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This returns a Boolean value: <code>True<\/code> if the &#8220;Extend list formats and formulas&#8221; option is enabled, and <code>False<\/code> otherwise. There are no parameters for this property, as it is read-only. The property is part of the <code>Application<\/code> object, which represents the Excel instance itself.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example Usage:<\/strong><br>Below is a practical example demonstrating how to use <code>ExtendList<\/code> in an xlwings script. This code checks the setting and prints a message, then conditionally performs an action based on the result, such as manually extending formulas if the feature is disabled.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Connect to the active Excel instance or start a new one\napp = xw.apps.active\n\n# Check the state of the ExtendList property\nextend_enabled = app.api.ExtendList\n\n# Output the result\nif extend_enabled:\n    print(\"Extend list formats and formulas is ENABLED in Excel.\")\nelse:\n    print(\"Extend list formats and formulas is DISABLED in Excel.\")\n\n# Example: If disabled, manually copy a formula down a column in a specific worksheet\nif not extend_enabled:\n    wb = app.books.active\n    ws = wb.sheets&#91;'Sheet1']\n    # Assume a formula exists in cell B2 and we want to extend it down to B10\n    formula_range = ws.range('B2:B10')\n    formula_range.formula = '=A2*2' # Set a sample formula\n    print(\"Manually extended formula in column B due to disabled ExtendList.\")\nelse:\n    print(\"Relying on Excel's auto-extension for formats and formulas.\")\n\n# Close the Excel instance if needed (optional)\napp.quit()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The `Application.ExtendList` property in Excel is a read-only Boolean property that indicates whethe&#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-2107","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2107","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=2107"}],"version-history":[{"count":1,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2107\/revisions"}],"predecessor-version":[{"id":3224,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2107\/revisions\/3224"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}