{"id":1977,"date":"2026-04-02T07:05:42","date_gmt":"2026-04-01T23:05:42","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=1977"},"modified":"2026-03-28T03:46:37","modified_gmt":"2026-03-28T03:46:37","slug":"how-to-use-applicationcheckspelling-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationcheckspelling-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.CheckSpelling in the xlwings API way"},"content":{"rendered":"\n<p>The Application.CheckSpelling method in Excel is a useful tool for checking the spelling of a single word or a text string programmatically. When accessed through the xlwings library in Python, it provides a way to integrate Excel&#8217;s built-in spelling checker into automated scripts and data processing workflows. This can be particularly valuable for validating user inputs, cleaning text data, or ensuring consistency in reports before they are finalized.<\/p>\n\n\n\n<p>In xlwings, the CheckSpelling method is called from the Application object. The syntax follows the pattern of the Excel Object Model, adapted for Python. The basic xlwings API call format is:<\/p>\n\n\n\n<p><code>app.api.CheckSpelling(Word, CustomDictionary, IgnoreUppercase, MainDictionary, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)<\/code><\/p>\n\n\n\n<p>The parameters are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Word<\/strong> (Required, String): The word or text string you want to check.<\/li>\n\n\n\n<li><strong>CustomDictionary<\/strong> (Optional, String): The file name of the custom dictionary to examine if the word is not found in the main dictionary. The default is an empty string.<\/li>\n\n\n\n<li><strong>IgnoreUppercase<\/strong> (Optional, Boolean): <code>True<\/code> to ignore words in all uppercase letters. <code>False<\/code> to check them. The default is <code>False<\/code>.<\/li>\n\n\n\n<li><strong>MainDictionary<\/strong> (Optional, Variant): This can be a language identifier (e.g., &#8220;en-US&#8221;) or a constant representing a built-in dictionary. It is often left as an optional argument in xlwings, defaulting to the application&#8217;s current language setting.<\/li>\n\n\n\n<li><strong>CustomDictionary2 to CustomDictionary10<\/strong> (Optional, String): Additional custom dictionary file names.<\/li>\n<\/ul>\n\n\n\n<p>The method returns a Boolean value. It returns <code>True<\/code> if the word is found in at least one of the specified dictionaries, and <code>False<\/code> if it is not found in any. This allows you to use the method in conditional logic within your Python code.<\/p>\n\n\n\n<p>Here are two practical xlwings code examples:<\/p>\n\n\n\n<p><strong>Example 1: Checking a Single Word<\/strong><br>This example checks if the word &#8220;Analyzze&#8221; is spelled correctly according to Excel&#8217;s dictionaries.<\/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 spelling of a word\nword_to_check = \"Analyzze\"\nis_correct = app.api.CheckSpelling(word_to_check)\n\nif is_correct:\n    print(f\"'{word_to_check}' is spelled correctly.\")\nelse:\n    print(f\"'{word_to_check}' is misspelled.\")\n    # This will output: 'Analyzze' is misspelled.<\/code><\/pre>\n\n\n\n<p><strong>Example 2: Checking Multiple Words from a List<\/strong><br>This example demonstrates iterating through a list of potential product codes or terms, using the spelling checker as a simple validation filter, and ignoring terms that are in all caps.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\napp = xw.apps.active\n\nterm_list = &#91;\"Project\", \"XYZZY\", \"Maintainance\", \"API\", \"Delevopment\"]\nvalid_terms = &#91;]\nflagged_terms = &#91;]\n\nfor term in term_list:\n    # Check spelling, ignoring words in all uppercase\n    if app.api.CheckSpelling(term, IgnoreUppercase=True):\n        valid_terms.append(term)\n    else:\n        flagged_terms.append(term)\n\nprint(\"Terms considered valid:\", valid_terms)\nprint(\"Terms flagged for review:\", flagged_terms)\n# Expected output:\n# Terms considered valid: &#91;'Project', 'XYZZY', 'API']\n# Terms flagged for review: &#91;'Maintainance', 'Delevopment']<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Application.CheckSpelling method in Excel is a useful tool for checking the spelling of a single&#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-1977","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/1977","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=1977"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/1977\/revisions"}],"predecessor-version":[{"id":3011,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/1977\/revisions\/3011"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=1977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=1977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=1977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}