{"id":32,"date":"2026-01-31T11:51:35","date_gmt":"2026-01-31T03:51:35","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=32"},"modified":"2026-01-17T04:53:14","modified_gmt":"2026-01-17T04:53:14","slug":"how-to-reference-multiple-cell-ranges-at-once-using-xlwings","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-reference-multiple-cell-ranges-at-once-using-xlwings\/","title":{"rendered":"How To Reference Multiple Cell Ranges at Once Using xlwings?"},"content":{"rendered":"<h2>Method<\/h2>\n<p>#xlwings<\/p>\n<p>sht[&#8216;A2, B3:C8, E2:F5&#8217;].select()\u00a0\u00a0\u00a0 #Reference multiple cell ranges<\/p>\n<p>#sht.range(&#8216;A2, B3:C8, E2:F5&#8217;).select()<\/p>\n<p>\u00a0<\/p>\n<p>#xlwings API<\/p>\n<p>#sht.api.Range(&#8216;A2, B3:C8, E2:F5&#8217;).Select()<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Reference multiple cell ranges at once\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\nsht&#91;'A2, B3:C8, E2:F5'].select()    #Reference multiple cell ranges\n#sht.range('A2, B3:C8, E2:F5').select()\n\n#xlwings API\n#sht.api.Range('A2, B3:C8, E2:F5').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=\"883\" height=\"482\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/01\/14.png\" alt=\"Reference Multiple Cell Ranges at Once Using xlwings\" class=\"wp-image-273\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/01\/14.png 883w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/01\/14-300x164.png 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/01\/14-768x419.png 768w\" sizes=\"auto, (max-width: 883px) 100vw, 883px\" \/><\/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-32","post","type-post","status-publish","format-standard","hentry","category-xlwings-cell-range"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/32","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=32"}],"version-history":[{"count":3,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":274,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/32\/revisions\/274"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}