{"id":51,"date":"2026-02-09T17:58:44","date_gmt":"2026-02-09T09:58:44","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=51"},"modified":"2026-01-17T05:51:27","modified_gmt":"2026-01-17T05:51:27","slug":"how-to-exchange-excel-worksheet-and-python-dictionary-data-using-xlwings","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-exchange-excel-worksheet-and-python-dictionary-data-using-xlwings\/","title":{"rendered":"How To Exchange Excel Worksheet and Python Dictionary Data Using xlwings?"},"content":{"rendered":"<h2>Method<\/h2>\n<h3 style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\"><span style=\"font-weight: bold;\">Reading<\/span><\/h3>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#xlwings<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">sht.range(&#8216;A1:B2&#8217;).options(dict).value<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#sht.range(&#8216;A4:B5&#8217;).options(dict, transpose=True).value<\/p>\n<h3 style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 8.0pt;\">\u00a0<\/h3>\n<h3 style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\"><span style=\"font-weight: bold;\">Writing<\/span><\/h3>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#xlwings<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#dic={ &#8216;a&#8217;: 1.0, &#8216;b&#8217;: 2.0}<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#sht.range(&#8216;A1:B2&#8217;).options(dict).value=dic<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">#sht.range(&#8216;A4:B5&#8217;).options(dict, transpose=True).value=dic<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Data Read\/Write Between Excel Sheets and Python Dictionaries\n\nimport xlwings as xw    #Import the xlwings package\n\napp=xw.App()\nbk=app.books.open('data.xlsx')\nsht=bk.sheets.active    #Get the active worksheet \n\n#Reading\n#xlwings\n#print(sht.range('A1:B2').options(dict).value)\n#print(sht.range('A4:B5').options(dict, transpose=True).value)\n\n#Writing\n#xlwings\ndic={ 'a': 1.0, 'b': 2.0}\nsht.range('A1:B2').options(dict).value=dic\nsht.range('A4:B5').options(dict, transpose=True).value=dic\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\/02\/47.png\" alt=\"Exchange Excel Worksheet and Python Dictionary Data Using xlwings\" class=\"wp-image-342\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/47.png 883w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/47-300x164.png 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/47-768x419.png 768w\" sizes=\"auto, (max-width: 883px) 100vw, 883px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"236\" src=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/48.png\" alt=\"\" class=\"wp-image-343\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/48.png 764w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/48-300x93.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/figure>\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\/02\/49.png\" alt=\"\" class=\"wp-image-344\" srcset=\"https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/49.png 883w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/49-300x164.png 300w, https:\/\/xlwings.net\/blog\/wp-content\/uploads\/2026\/02\/49-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":[4],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-xlwings-data"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/51","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=51"}],"version-history":[{"count":3,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":345,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/51\/revisions\/345"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}