+ 1
Is any one know how to get to print cell index address (eg. A5,B1..)of an cell of excel sheet using openpyxl in python
3 odpowiedzi
+ 4
# Did you have tried:
print(cell.column_name+str(cell.row))
# https://openpyxl.readthedocs.io/en/stable/api/openpyxl.cell.cell.html
+ 1
Running that print statement shows name error that 'cell' is not defined
+ 1
Seems my last post has disapeared :o
I was telling you that you should replace the "cell" variable with a variable containing the cell you want to get its string address (eg. A5,B1...).
Or you could try to call this function (with the targeted cell as argument ^^):
def get_cell_address(cell):
return cell.column_name+str(cell.row)
# use example
c = ??? # here come the code to retrieve the cell object you want to get address
print(get_cell_address)