+ 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

1st May 2020, 2:33 PM
Lukmanul Hakeem M
Lukmanul Hakeem M - avatar
3 Réponses
+ 4
# Did you have tried: print(cell.column_name+str(cell.row)) # https://openpyxl.readthedocs.io/en/stable/api/openpyxl.cell.cell.html
1st May 2020, 9:19 PM
visph
visph - avatar
+ 1
Running that print statement shows name error that 'cell' is not defined
2nd May 2020, 6:22 AM
Lukmanul Hakeem M
Lukmanul Hakeem M - avatar
+ 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)
3rd May 2020, 11:53 AM
visph
visph - avatar