Apr-22-2020, 09:46 AM
Hello, this is my first post.
A tutorial I am following tells me to type this code:
Traceback (most recent call last):
File "/Users/marktimmermans/Desktop/untitled2/test2.py", line 66, in <module>
cells = sheet['A1', 'B7']
File "/Users/marktimmermans/.local/share/virtualenvs/marktimmermans-1t9Wp73_/lib/python3.7/site-packages/openpyxl/worksheet/worksheet.py", line 286, in __getitem__
min_col, min_row, max_col, max_row = range_boundaries(key)
File "/Users/marktimmermans/.local/share/virtualenvs/marktimmermans-1t9Wp73_/lib/python3.7/site-packages/openpyxl/utils/cell.py", line 133, in range_boundaries
m = ABSOLUTE_RE.match(range_string)
TypeError: expected string or bytes-like object
PS: here you can find the tutorial: https://www.javatpoint.com/python-openpyxl (I used a file of my own)
A tutorial I am following tells me to type this code:
import openpyxl wb = openpyxl.load_workbook('marks.xlsx') sheet = wb.active # cells = sheet['A1','B7'] # cells behave like range operator for i1,i2 in cells: print("{0:8} {1:8}".format(i1.value,i2.value))However, I get this error:
Traceback (most recent call last):
File "/Users/marktimmermans/Desktop/untitled2/test2.py", line 66, in <module>
cells = sheet['A1', 'B7']
File "/Users/marktimmermans/.local/share/virtualenvs/marktimmermans-1t9Wp73_/lib/python3.7/site-packages/openpyxl/worksheet/worksheet.py", line 286, in __getitem__
min_col, min_row, max_col, max_row = range_boundaries(key)
File "/Users/marktimmermans/.local/share/virtualenvs/marktimmermans-1t9Wp73_/lib/python3.7/site-packages/openpyxl/utils/cell.py", line 133, in range_boundaries
m = ABSOLUTE_RE.match(range_string)
TypeError: expected string or bytes-like object
PS: here you can find the tutorial: https://www.javatpoint.com/python-openpyxl (I used a file of my own)