{"id":23,"date":"2026-01-26T18:03:38","date_gmt":"2026-01-26T10:03:38","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=23"},"modified":"2026-01-17T04:36:25","modified_gmt":"2026-01-17T04:36:25","slug":"how-to-reference-cells-by-name-using-xlwings","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-reference-cells-by-name-using-xlwings\/","title":{"rendered":"How To Reference Cells by Name Using xlwings?"},"content":{"rendered":"<h2>Method<\/h2>\n<p>#xlwings<\/p>\n<p>cl=sht.cells(3,3)<\/p>\n<p>cl.name=&#8217;test&#8217;\u00a0\u00a0\u00a0 #Setting the cell name<\/p>\n<p>sht.range(&#8216;test&#8217;).select()\u00a0\u00a0\u00a0 #Referencing the cell by it&#8217;s name<\/p>\n<p>\u00a0<\/p>\n<p>#xlwings API<\/p>\n<p>#cl=sht.api.Range(&#8216;C3&#8217;)<\/p>\n<p>#cl.Name=&#8217;test&#8217;<\/p>\n<p>#sht.api.Range(&#8216;test&#8217;).Select()<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Referencing by Cell Name\n\nimport xlwings as xw    #Import the xlwings package\n\napp=xw.App()\nbk=app.books.active    #Get the active workbook\nsht=bk.sheets.active    #Get the active worksheet \n\n#xlwings\ncl=sht.cells(3,3)\ncl.name='test'    #Setting the cell name\nsht.range('test').select()    #Referencing the cell by it's name\n\n#xlwings API\n#cl=sht.api.Range('C3')\n#cl.Name='test'\n#sht.api.Range('test').Select()\n\n#bk.close()\n#app.kill()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"458\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/01\/5.png\" alt=\"Reference Cells by Name Using xlwings\" class=\"wp-image-246\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/01\/5.png 849w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/01\/5-300x162.png 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/01\/5-768x414.png 768w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Method<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-xlwings-cell-range"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/23","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=23"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":247,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/23\/revisions\/247"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}