Save to Excel with invalid coordinate or range

I have this script that writes to a Excel sheet, I’m using openpyxl but I’m getting an error. Here’s my cod:

 ws['A{0}'.format(str(row2sav))] = rowid
 ws['A{0}'.format(str(row2sav))].fill = PatternFill(bgColor="#7EB33D", fill_type="solid")

I get

ValueError: A9 is not a valid coordinate or range

But row2sav is 9 so the A9 is correct. Why do I get this error?

this (ws[‘A{0}’.format(str(row2sav))] = rowid) works when i create the file but then later on when i open the file and try to save value to it it wont work, am i opening the file right?

wb = load_workbook(os.path.join('Reports', filename_report))
    if "fromger" in tipo:
        ws = wb['Central to ChargeStation']
        ws['A8'] = "testing"

Answer

weird. I tried your first line and it worked just fine. maybe you have a special character next to A or in row2sav. to debug it I would suggest to do it in steps. first do:

ws['A9'] = 'test'

to check if it works. if it does, start replacing one by one the hard-coded string with their variables and then you can figure out where the problem is.