{"id":2039,"date":"2026-05-03T07:45:55","date_gmt":"2026-05-02T23:45:55","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2039"},"modified":"2026-03-28T05:32:12","modified_gmt":"2026-03-28T05:32:12","slug":"how-to-use-applicationautopercententry-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationautopercententry-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.AutoPercentEntry in the xlwings API way"},"content":{"rendered":"\n<p>The <code>AutoPercentEntry<\/code> property of the <code>Application<\/code> object in Excel is a feature that controls the automatic conversion of decimal numbers into percentages when entered into cells. When this property is set to <code>True<\/code>, any decimal value (e.g., entering 0.15) typed into a cell will automatically be formatted as a percentage (15%). This can significantly streamline data entry in scenarios where percentage inputs are frequent, reducing the need for manual formatting. However, it&#8217;s important to note that this is a global application setting, meaning it affects all open workbooks and worksheets. Users should be cautious, as enabling it might inadvertently convert decimal data intended as other numeric types.<\/p>\n\n\n\n<p>In the xlwings API, which provides a powerful bridge between Python and Excel, you access this property through the <code>app<\/code> object, which represents the Excel application. The property is available for both getting its current state and setting it to a new value.<\/p>\n\n\n\n<p><strong>Syntax in xlwings:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app.api.AutoPercentEntry<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Get:<\/strong> <code>current_state = app.api.AutoPercentEntry<\/code><\/li>\n\n\n\n<li><strong>Set:<\/strong> <code>app.api.AutoPercentEntry = new_value<\/code><\/li>\n\n\n\n<li><strong>Parameters:<\/strong> This property does not take parameters. It is a Boolean property where <code>True<\/code> enables automatic percentage entry and <code>False<\/code> disables it.<\/li>\n<\/ul>\n\n\n\n<p><strong>Code Examples:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Checking the Current Setting:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\napp = xw.apps.active # Get the active Excel application\nis_enabled = app.api.AutoPercentEntry\nprint(f\"AutoPercentEntry is currently set to: {is_enabled}\")<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Enabling AutoPercentEntry:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\napp = xw.apps.active\napp.api.AutoPercentEntry = True\nprint(\"AutoPercentEntry has been enabled.\")\n# Now, entering 0.2 in a cell will display as 20%.<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Disabling AutoPercentEntry:<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\napp = xw.apps.active\napp.api.AutoPercentEntry = False\nprint(\"AutoPercentEntry has been disabled.\")\n# Decimal entries will now remain as decimals unless manually formatted.<\/code><\/pre>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li><strong>Practical Workflow Example:<\/strong> This script toggles the setting, enters a test value, and then restores the original state.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\napp = xw.apps.active\noriginal_setting = app.api.AutoPercentEntry\n\n# Enable for a task\napp.api.AutoPercentEntry = True\nwb = app.books.active\nws = wb.sheets&#91;0]\nws.range('A1').value = 0.35 # Will appear as 35% in Excel\nprint(\"Test value 0.35 entered into A1 with AutoPercentEntry ON.\")\n\n# Restore original setting\napp.api.AutoPercentEntry = original_setting\nprint(f\"AutoPercentEntry restored to {original_setting}.\")<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The `AutoPercentEntry` property of the `Application` object in Excel is a feature that controls the &#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-2039","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2039","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=2039"}],"version-history":[{"count":1,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2039\/revisions"}],"predecessor-version":[{"id":3116,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2039\/revisions\/3116"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2039"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2039"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2039"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}