0
I have a problem reading a file . xls using Python with Flask.
My code:
from openpyxl import load_workbook
wb = load_workbook(filename=settings.MEDIA_ROOT + '/xls/arquivo.xls', read_only=True)
ws = wb['Tab 1']
for row in ws.get_squared_range(min_col=2,max_col=34, min_row=2, max_row=61):
for cell in row:
print(cell.value)
The error obtained is:
Nameerror: name 'Settings' is not defined
I tried to do an edit to try to make it more readable. I could check if I didn’t add some accidental level of indentation to the original code?
– Jefferson Quesado
You mentioned the import of this Séttings, didn’t you? https://stackoverflow.com/questions/12844953/how-to-access-media-root-in-py-file. The link is about Django but the idea is the same.
– rodrigorf