Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to close a workbook using xlrd

Tags:

I am using the function open_workbook() to open an excel file. But I cannot find any function to close the file later in the xlrd module. Is there a way to close the xls file using xlrd? Or is not required at all?

like image 641
Sumod Avatar asked Mar 23 '11 10:03

Sumod


People also ask

How do you close a workbook in XLRD?

In case of using on_demand = True at opening, one need to call book. release_resources() on closing.

How do I open a XLSX file with XLRD?

Run the following command from the terminal to install the required version of xlrd. After completing the installation process, create a python file with the following script to read the sales. xlsx file using the xlrd module. open_workbook() function is used in the script open the xlsx file for reading.


1 Answers

Digging into the mailing list archive, it seems that the file object is closed directly by the constructor, so you don't need to close it explicitly.

like image 72
Andrea Spadaccini Avatar answered Sep 20 '22 09:09

Andrea Spadaccini