Reputation: 177
I tried a couple of ways to do so but didn't found the better way to open my excel file which is as shown in below pic.
Here is one of the example I tried.
import xlrd
def read_open_exls(path):
book = xlrd.open_workbook(path)
print(book)
if __name__ == '__main__':
read_open_exls(casemon.xls)
Thanks in Advance.
Upvotes: 0
Views: 2787
Reputation: 81
I'm not sure if a workbook is printable at all.
you should first select a sheet. and then you can read values from that sheet.
from openpyxl import load_workbook
wb = load_workbook(filename = 'empty_book.xlsx')
sheet_ranges = wb['range names']
print(sheet_ranges['D18'].value)
https://openpyxl.readthedocs.io/en/default/usage.html
Upvotes: 1