{"id":1993,"date":"2026-04-10T07:52:14","date_gmt":"2026-04-09T23:52:14","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=1993"},"modified":"2026-03-28T04:10:13","modified_gmt":"2026-03-28T04:10:13","slug":"how-to-use-applicationgetphonetic-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationgetphonetic-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.GetPhonetic in the xlwings API way"},"content":{"rendered":"\n<p>The <strong>GetPhonetic<\/strong> member of the Excel <strong>Application<\/strong> object is a method that retrieves the Japanese phonetic (furigana) text for a specified string or cell. This is particularly useful when working with Japanese data, as it allows you to programmatically access the phonetic guides often used to indicate the pronunciation of Kanji characters. In xlwings, this functionality is exposed through the <code>api<\/code> property, which provides direct access to the underlying Excel object model.<\/p>\n\n\n\n<p>The syntax for calling <strong>GetPhonetic<\/strong> in xlwings is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>app.api.GetPhonetic(Text)<\/code><\/pre>\n\n\n\n<p>Where:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>app<\/code> is an instance of the xlwings <code>App<\/code> class, representing the Excel application.<\/li>\n\n\n\n<li><code>Text<\/code> (optional): This parameter specifies the text for which to retrieve the phonetic information. It can be a string or a reference to a cell. If omitted, the method returns the phonetic text for the last processed text.<\/li>\n<\/ul>\n\n\n\n<p>The <code>Text<\/code> parameter accepts different types of inputs, which determine its behavior:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Input Type<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><strong>String<\/strong><\/td><td>A literal text string (e.g., <code>\"\u6771\u4eac\"<\/code>). The method returns the phonetic text for that string.<\/td><\/tr><tr><td><strong>Range Reference<\/strong><\/td><td>A reference to a cell (e.g., <code>app.range('A1')<\/code>). The method returns the phonetic text for the cell&#8217;s value.<\/td><\/tr><tr><td><strong>Omitted<\/strong><\/td><td>If the parameter is not provided, Excel uses the last text that was processed for phonetics.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>It&#8217;s important to note that the <strong>GetPhonetic<\/strong> method is primarily designed for Japanese text and may not return meaningful results for other languages. Additionally, the phonetic information must be present in the Excel file; it is often added through features like &#8220;Phonetic Guide&#8221; in Excel&#8217;s UI.<\/p>\n\n\n\n<p>Here are two xlwings code examples demonstrating the use of <strong>GetPhonetic<\/strong>:<\/p>\n\n\n\n<p><strong>Example 1: Retrieving phonetic text from a string<\/strong><\/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# Get phonetic text for the Japanese string \"\u6771\u4eac\" (Tokyo)\nphonetic_text = app.api.GetPhonetic(\"\u6771\u4eac\")\nprint(phonetic_text) # Output might be \"\u30c8\u30a6\u30ad\u30e7\u30a6\" depending on Excel's settings<\/code><\/pre>\n\n\n\n<p><strong>Example 2: Retrieving phonetic text from a cell<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Start a new workbook\nwb = xw.Book()\nsheet = wb.sheets&#91;0]\n\n# Write a Japanese word with phonetic guide to cell A1 (assume phonetic is added via Excel)\nsheet.range('A1').value = \"\u6771\u4eac\"\n\n# Retrieve the phonetic text from cell A1\nphonetic_text = wb.app.api.GetPhonetic(sheet.range('A1'))\nprint(phonetic_text) # Output will be the phonetic text associated with the cell's content<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The **GetPhonetic** member of the Excel **Application** object is a method that retrieves the Japane&#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-1993","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/1993","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=1993"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/1993\/revisions"}],"predecessor-version":[{"id":3037,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/1993\/revisions\/3037"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=1993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=1993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=1993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}