Python Tutoring Online
 Home            

Openpyxl load_workbook()

In this article you will learn how to load or open a workbook in Python using openpyxl load_workbook() function. This method is used when you have to read or write to an existing excel file in Python. 

Syntax of load_workbook()

The syntax of load workbook function is 

ref_to_workbook = openpyxl.load_workbook(file name)

This syntax will work if your existing excel file is in your current working directory. In case if you want to access a spreadsheet from anywhere on your computer you will provide a path to your file with full file name and extension. 

ref_to_workbook = openpyxl.load_workbook(path)

where path can be like 

"c:/myfiles/testfile.xlsx"

Example: load_workbook()

First example is when a file named uberdata.xlsx is in your current working directory and you want to open it or load it in python using openpyxl.

import openpyxl

mywb = openpyxl.load_workbook("uberdata.xlsx")

If excel file is not in your working directory, write full path of file with name and extension.

mywb = openpyxl.load_workbook("D:/datafiles/uberdata.xlsx")



Stuck Learning Python?

Struggling with Python syntax, assignments or debugging errors? Learning alone can be frustrating.

Get 1-on-1 Python tutoring and learn faster with clear explanations, real examples and live help.

    Get Python Tutoring

Struggling to Learn Python?

Get 1-on-1 Python tutoring designed for beginners and professionals. Learn step-by-step with real examples and personal guidance.

✓ Understand Python fundamentals quickly

✓ Solve assignments and coding problems

✓ Learn automation and real-world projects

✓ Build confidence in programming

✓ Learn from Experts & Professionals


Start learning Python today

Book Your First Lesson

Need Help With Python Projects?

Get expert support with your Python assignments, coursework, data analysis tasks, and real programming projects.

✓ Python project guidance

✓ Machine learning basics

✓ Data analysis with Pandas & NumPy

✓ Debugging and code improvement

✓ Interview preparation help


Finish your Python project faster

Get Python Help

Become Confident in Python

Learn Python with structured lessons, real coding practice, and personalized feedback from an experienced tutor.

✓ Live online Python tutoring via Zoom

✓ Personalized learning plan

✓ Practical coding exercises

✓ Learn Python for work or career

✓ Flexible tutoring schedule


Build real Python skills

Start Learning Python


PythonTutor.net

Home    Tutorial     Online Live Trainings    Contact Us           © 2026 All rights reserved by www.PythonTutor.net