{"id":2034,"date":"2026-04-30T16:29:30","date_gmt":"2026-04-30T08:29:30","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2034"},"modified":"2026-03-28T05:28:36","modified_gmt":"2026-03-28T05:28:36","slug":"how-to-use-applicationasktoupdatelinks-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationasktoupdatelinks-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.AskToUpdateLinks in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <code>Application.AskToUpdateLinks<\/code> property in Excel&#8217;s object model is a Boolean value that controls whether Excel prompts the user to update links when opening a workbook containing external links. When set to <code>True<\/code> (the default), Excel displays a dialog box asking the user if they want to update the links. When set to <code>False<\/code>, Excel opens the workbook without prompting and does not automatically update the links, which can speed up the opening process in automated scripts or when the user does not need the latest linked data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In xlwings, you can access and manipulate this property through the <code>App<\/code> object, which represents the Excel application. The syntax is straightforward: <code>app.api.AskToUpdateLinks<\/code>. Here, <code>app<\/code> is your xlwings <code>App<\/code> instance, and the <code>.api<\/code> attribute provides direct access to the underlying Excel object model, allowing you to use the standard <code>Application<\/code> object properties and methods. The property accepts and returns a Boolean value (<code>True<\/code> or <code>False<\/code>). It&#8217;s important to note that this setting is application-wide, meaning it affects all workbooks opened in that Excel instance while the setting is active.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, to disable the prompt for updating links when opening a workbook, you can set <code>AskToUpdateLinks<\/code> to <code>False<\/code>. This is particularly useful in automation scenarios where you want to suppress user interactions. After opening the workbook, you might want to restore the original setting to avoid affecting other operations. Here&#8217;s a code example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Start Excel application (visible or not)\napp = xw.App(visible=False)\n\n# Disable the prompt for updating links\napp.api.AskToUpdateLinks = False\n\n# Open a workbook that contains external links\nwb = app.books.open('workbook_with_links.xlsx')\n\n# Perform operations on the workbook...\n# For instance, you can manually update links if needed:\n    # wb.api.UpdateLinks()\n\n# Re-enable the prompt for future operations\napp.api.AskToUpdateLinks = True\n\n# Save and close\nwb.save()\nwb.close()\napp.quit()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, we start by creating an Excel application instance with <code>visible=False<\/code> to run in the background. Setting <code>app.api.AskToUpdateLinks = False<\/code> ensures that no dialog appears when opening <code>workbook_with_links.xlsx<\/code>. If you need to update the links programmatically, you can call <code>wb.api.UpdateLinks()<\/code> (though this is not directly related to <code>AskToUpdateLinks<\/code>). Finally, we reset the property to <code>True<\/code> before closing to maintain default behavior for other uses, and then clean up by closing the workbook and quitting the app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Another common use case is to check the current state of this property. You can retrieve its value to determine if prompts are enabled:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\napp = xw.App(visible=True)\ncurrent_setting = app.api.AskToUpdateLinks\nprint(f\"AskToUpdateLinks is currently set to: {current_setting}\")\n# This might output: AskToUpdateLinks is currently set to: True\napp.quit()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The `Application.AskToUpdateLinks` property in Excel&apos;s object model is a Boolean value that controls&#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-2034","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2034","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=2034"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2034\/revisions"}],"predecessor-version":[{"id":3109,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2034\/revisions\/3109"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}