{"id":181,"date":"2026-01-19T18:09:17","date_gmt":"2026-01-19T10:09:17","guid":{"rendered":"https:\/\/openpyxl.com\/blog\/?p=181"},"modified":"2026-01-16T05:31:08","modified_gmt":"2026-01-16T05:31:08","slug":"how-to-open-an-existing-workbook-file-using-openpyxl","status":"publish","type":"post","link":"https:\/\/openpyxl.com\/blog\/how-to-open-an-existing-workbook-file-using-openpyxl.html","title":{"rendered":"How To Open an Existing Workbook File Using OpenPyXL?"},"content":{"rendered":"<h2>Method<\/h2>\n<p>The `load_workbook` function can be used to open an existing workbook file. The function&#8217;s syntax is:<\/p>\n<p><b>wb=openpyxl.load_workbook(filename,read_only,keep_vba,guess_types, <\/b><b>data_only,keep_links) <\/b><\/p>\n<p>Where:<\/p>\n<p>`filename` \u2014 a string representing the file path and name of the file to be opened.<\/p>\n<p>`read_only` \u2014 a boolean indicating read-only mode. Setting it to read-only helps save memory for large files.<\/p>\n<p>`keep_vba` \u2014 a boolean for files with VBA macros. If True, it retains the VBA code.<\/p>\n<p>`guess_types` \u2014 a boolean that determines whether to guess data types when reading data from the worksheet.<\/p>\n<p>`data_only` \u2014 a boolean specifying whether to display the most recent calculation results in cells containing formulas.<\/p>\n<p>`keep_links` \u2014 a boolean indicating whether to preserve external links.<\/p>\n<p>This function returns a workbook object.<\/p>\n<h2>Sample Code<\/h2>\n\n\n<pre class=\"wp-block-code\"><code>#Opening an Existing Workbook\n\n#Import the load_workbook function\nfrom openpyxl import load_workbook\n\n#Load an existing workbook file\nwb=load_workbook('test.xlsx')<\/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":[2],"tags":[],"class_list":["post-181","post","type-post","status-publish","format-standard","hentry","category-openpyxl-workbook"],"_links":{"self":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/181","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=181"}],"version-history":[{"count":2,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/181\/revisions"}],"predecessor-version":[{"id":194,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/posts\/181\/revisions\/194"}],"wp:attachment":[{"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/media?parent=181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/categories?post=181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/openpyxl.com\/blog\/wp-json\/wp\/v2\/tags?post=181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}