With the following script I try to get the data from a range of cells:
wb=openpyxl.load_workbook('testfile.xlsx')
sheet = wb.get_sheet_by_name('Hoja1')
# Imprimir un rango
multiple_cells = sheet['A1':'C20']
for row in multiple_cells:
for cell in row:
print cell.value
When I run it, I get the error:
File "E:/Python/Openpyxl/Practicas_openpyxl.py", line 43
for cell in row:
^
SyntaxError: invalid character in identifier
I can not tell where the fault is.
On the other hand, is it possible to give a variable name to the imported range and convert it into a DataFrame? How could I do it?