{"id":2266,"date":"2026-08-24T16:34:19","date_gmt":"2026-08-24T08:34:19","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2266"},"modified":"2026-03-28T12:07:23","modified_gmt":"2026-03-28T12:07:23","slug":"how-to-use-worksheetscreator-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-worksheetscreator-in-the-xlwings-api-way\/","title":{"rendered":"How to use Worksheets.Creator in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <strong>Creator<\/strong> property of the <strong>Worksheets<\/strong> object in the Excel object model is a read-only property that returns a 32-bit integer indicating the application in which the specified object was created. This property is primarily used to identify the creator application, especially in scenarios involving OLE (Object Linking and Embedding) automation or when working with objects that might be shared across different applications (e.g., between Microsoft Excel and another application like Microsoft Word). In xlwings, you can access this property to retrieve this creator code, which can be useful for debugging, logging, or conditional logic based on the originating application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Functionality:<\/strong><br>The main purpose of the Creator property is to provide a unique identifier for the application that created the Excel workbook or specific object. This can be particularly helpful in macro-enabled environments or when integrating Excel with other Office applications through COM automation. For the Worksheets object, it refers to the collection of all worksheets in a workbook, and accessing its Creator property returns the creator code for the entire workbook&#8217;s worksheet collection. Note that this property is inherited from the base object model and is not commonly used in everyday xlwings scripting, but it can be valuable in advanced automation tasks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Syntax:<\/strong><br>In xlwings, you can access the Creator property via the <code>api<\/code> property of a workbook or worksheet object, which exposes the underlying Excel object model. The general syntax is as follows:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>workbook_or_worksheet_object.api.Creator<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>workbook_or_worksheet_object<\/strong>: This is an xlwings object representing a workbook or a specific worksheet. For the Worksheets object, you typically access it through a workbook.<\/li>\n\n\n\n<li><strong>api<\/strong>: This property provides direct access to the pywin32 or appscript object, allowing you to call native Excel VBA object model properties and methods.<\/li>\n\n\n\n<li><strong>Creator<\/strong>: This is the property name, and it does not take any parameters. It returns a Long (32-bit integer) value.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The return value is an integer code. For Microsoft Excel, the standard creator code is <code>1480803660<\/code> (hexadecimal: <code>0x5843454C<\/code>), which corresponds to &#8220;XCEL&#8221; in ASCII. Other applications have different codes; for example, Microsoft Word uses <code>1297307460<\/code> (hexadecimal: <code>0x4D535744<\/code> for &#8220;MSWD&#8221;).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Examples:<\/strong><br>Here are some xlwings code examples demonstrating how to use the Creator property with the Worksheets object:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Accessing Creator for the entire Worksheets collection in a workbook:<\/strong><br>This example opens an Excel workbook and retrieves the creator code for its worksheets collection.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Open an existing workbook\nwb = xw.Book('example.xlsx')\n\n# Access the Worksheets object's Creator property via the workbook's api\ncreator_code = wb.api.Worksheets.Creator\n\n# Print the creator code\nprint(f\"Creator code for the worksheets collection: {creator_code}\")\n\n# Check if it was created by Excel\nif creator_code == 1480803660:\n    print(\"This workbook was created by Microsoft Excel.\")\nelse:\n    print(\"This workbook was created by another application.\")<\/code><\/pre>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li><strong>Accessing Creator for a specific worksheet within the collection:<\/strong><br>This example shows how to get the creator code for a particular worksheet, which will be the same as the workbook&#8217;s creator since worksheets are part of the Excel file.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Open a workbook and select a specific worksheet\nwb = xw.Book('example.xlsx')\nws = wb.sheets&#91;'Sheet1'] # xlwings sheet object\n\n# Access the Creator property via the worksheet's underlying api\ncreator_code = ws.api.Creator # This accesses the Worksheet object's Creator\n\n# Alternatively, access through the Worksheets collection\ncreator_code_via_collection = wb.api.Worksheets('Sheet1').Creator\n\nprint(f\"Creator code for Sheet1: {creator_code}\")\nprint(f\"Creator code via collection: {creator_code_via_collection}\")<\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li><strong>Using Creator in a loop to inspect all worksheets:<\/strong><br>This example iterates through all worksheets in a workbook and logs their creator codes, which should be consistent across all sheets.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\nwb = xw.Book('example.xlsx')\n\nfor sheet in wb.sheets:\n    creator = sheet.api.Creator\n    sheet_name = sheet.name\n    print(f\"Worksheet '{sheet_name}' has creator code: {creator}\")\n\n# Close the workbook if needed\nwb.close()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The **Creator** property of the **Worksheets** object in the Excel object model is a read-only prope&#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-2266","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2266","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=2266"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2266\/revisions"}],"predecessor-version":[{"id":3461,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2266\/revisions\/3461"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}