{"id":12,"date":"2026-01-23T18:41:07","date_gmt":"2026-01-23T10:41:07","guid":{"rendered":"https:\/\/openpyxl.com\/blog\/?p=12"},"modified":"2026-01-16T05:58:14","modified_gmt":"2026-01-16T05:58:14","slug":"how-to-reference-single-or-multiple-rowscolumns-using-openpyxl","status":"publish","type":"post","link":"https:\/\/openpyxl.com\/blog\/how-to-reference-single-or-multiple-rowscolumns-using-openpyxl.html","title":{"rendered":"How To Reference Single or Multiple Rows\/Columns Using OpenPyXL?"},"content":{"rendered":"<h2>Method<\/h2>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Reference rows or columns by their index or column letter.<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">\u00a0<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Reference a single row\/column<\/p>\n<p style=\"margin: 0in; font-family: \u5fae\u8f6f\u96c5\u9ed1; font-size: 14.0pt;\">Reference continuous multiple rows\/columns<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Accessing Specific Rows and Columns\n\n#Import load_workbook function\nfrom openpyxl import Workbook\n\n#Create a new workbook\nwb=Workbook()\n#Get the active worksheet\nws=wb.active\n\n#Get the 10th row\nrow10=ws&#91;10]\n#Get the 3rd column\ncolC=ws&#91;'C']\n\n#Get multiple rows\nrows1=ws&#91;5:10]\n#Get multiple columns\ncols1=ws&#91;'C:D']\n\nwb.save('test.xlsx')\nwb.close()<\/code><\/pre>\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":[1],"tags":[],"class_list":["post-12","post","type-post","status-publish","format-standard","hentry","category-openpyxl-worksheet"],"_links":{"self":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/12","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=12"}],"version-history":[{"count":2,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":216,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions\/216"}],"wp:attachment":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}