Sumod
Sumod

Reputation: 3846

Is there a way to close a workbook using xlrd

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?

Upvotes: 23

Views: 23155

Answers (2)

Tripy
Tripy

Reputation: 96

The open_workbook calls the release_resources ( which closes the mmaped file ) before returning.

Upvotes: 6

Andrea Spadaccini
Andrea Spadaccini

Reputation: 12651

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.

Upvotes: 22

Related Questions