Python Tutoring Online
 Home            

Openpyxl close() Workbook

In this article you will learn how to close a workbook file in python using openpyxl close() function. 

Syntax of close()

The syntax to close an excel file in openpyxl is very simple i.e

workbook_object.close()

Here workbook object is the workbook which is open and now you want to close it. Its better to save the workbook before closing it.

Example: Openpyxl close() function

An important thing to note is that close() function will close any file which is open in current python environment. Ofcourse, there is no need to close a file which is not open and already closed. 

>>> # First save the file

>>> workbook.save(file)

>>> workbook.close()

Close function will not take any argument. It will simply close the workbook object. After closing the file, you will not be able to access it until you open it again.

Non Computer Science Background Students

We Specialize in teaching and tutoring Python from intro to advanced modules like Pandas and Machine learning to Non Programming and Non computer science Python learners.

If you are not from CS We will train you that there will be no difference between your Python skills and CS programmers Python skills.

Join Now

Python Programming online tutors


Python Programming for Beginners

Python for Advanced Level

for University Python Programming Course

for Practical tasks at work

Python Projects Help & Guidance

Automating your computing tasks


Learn Python, Advance in your Career Join Now

For More information

Python Trainings Online


Python for Non Programmers Training

Machine Learning for Beginners Training

Deep Learning for Beginners Training

Python Pandas Training Tutors

Numpy, Matplotlib, Scipy Tutors

Keras, Tensorflow, Theano Tutors


Flexible and Tailored for your Specific Needs

More info on Trainings

Python Online Training Features


Live (1 on 1) Python Tutoring at Skype

Learn Practical Examples

Work on Python Projects

High Quality Training from Experts

You may select your Syllabus for Tutoring

Flexible Timings: Select time which suits you


Guaranteed Learning

Join Course

PythonTutor.net

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