{"id":51,"date":"2026-02-12T11:26:14","date_gmt":"2026-02-12T03:26:14","guid":{"rendered":"https:\/\/openpyxl.com\/blog\/?p=51"},"modified":"2026-01-16T07:41:34","modified_gmt":"2026-01-16T07:41:34","slug":"how-to-reference-pivot-tables-using-openpyxl","status":"publish","type":"post","link":"https:\/\/openpyxl.com\/blog\/how-to-reference-pivot-tables-using-openpyxl.html","title":{"rendered":"How To Reference Pivot Tables Using OpenPyXL?"},"content":{"rendered":"<h2>Method<\/h2>\n<p>pivot=ws._pivots[0]\u00a0\u00a0\u00a0 #Reference the 1st Pivot Table<\/p>\n<p>print(pivot.name)\u00a0\u00a0\u00a0 #Name of the Pivot Table<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Reference Pivot Table\n\nfrom openpyxl import load_workbook\n\n#Load Workbook\nwb=load_workbook('Pivot.xlsx')\n#Get Worksheet\nws=wb&#91;'Pivot Table']\n\npivot=ws._pivots&#91;0]    #Reference the 1st Pivot Table\nprint(pivot.name)    #Name of the Pivot Table\n\n#Pivot Table Overview\nprint(pivot.summary)\n\nwb.save('test.xlsx')<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"878\" height=\"525\" src=\"https:\/\/openpyxl.com\/blog\/wp-content\/uploads\/2026\/02\/33.png\" alt=\"Reference Pivot Tables Using OpenPyXL\" class=\"wp-image-323\" srcset=\"https:\/\/openpyxl.com\/blog\/wp-content\/uploads\/2026\/02\/33.png 878w, https:\/\/openpyxl.com\/blog\/wp-content\/uploads\/2026\/02\/33-300x179.png 300w, https:\/\/openpyxl.com\/blog\/wp-content\/uploads\/2026\/02\/33-768x459.png 768w\" sizes=\"auto, (max-width: 706px) 89vw, (max-width: 767px) 82vw, 740px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenPyXL<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-openpyxl-pivot-table"],"_links":{"self":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":2,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":324,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/51\/revisions\/324"}],"wp:attachment":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}