Greetings Eric Gazoni, Charlie Clark,
I am using openpyxl version 2.3.2, and I encountered an interesting issue while running openpyxl under ipython.
Here is a snippet of my code:
#!/usr/bin/python # -*- coding: utf-8 -*- # # SOURCE: http://openpyxl.readthedocs.org/en/latest/optimized.html # reads in xls file line-by-line using regular and fast read only... import openpyxl import os.path import string from openpyxl import load_workbook # # spreadsheet = "example.xlsx" # use whatever spreadsheet you have # def rsheet(cell): '''Reads in a sheet''' wb = openpyxl.load_workbook(spreadsheet) ws = "".join(wb.get_sheet_names()) sheet_ranges = wb[ws] return (sheet_ranges[cell].value) # def rosheet(cell): '''Reads in a sheet''' # wb = openpyxl.load_workbook(spreadsheet) wb = load_workbook(filename=spreadsheet, read_only=True) ws = "".join(wb.get_sheet_names()) sheet_ranges = wb[ws] return (sheet_ranges[cell].value) ## # print "This is with regular open: "rsheet("A1") print "This is with fast open: "rosheet("A1") print "Now go to outside the range of your sheet and do it again, I picked 1000" print rsheet("A1000") print "...as you can see above this gave a 'None' answer" print rosheet("A1000") Print "This last thing is the bug..."
Thank you both profusely for your excellent code. If this is actually fixed in 2.4.0 I will get to loading it.