D
D
Dmustache Usakov2021-09-07 23:05:45
Python
Dmustache Usakov, 2021-09-07 23:05:45

How to overwrite data from JSON in Excel to an existing sheet?

I'm trying to write data from a JSON file I created to an Excel data file (to an existing sheet)
But I can't, please help.
The code.

wb = openpyxl.load_workbook('data.xlsx')['test']
for i in range(1, len(dic) + 1):
    wb[f'A{i}'].value, wb[f'A{i}'].value, wb[f'A{i}'].value = str(dic[i]['studentName']), str(dic[i]['studentCF']), str(dic[i]['studentRank'])


{
   "1": {
        "studentName": "Юрий Голышев",
        "studentCF": "Fefer_Ivan",
        "studentRank": "2174"
    },
    "2": {
        "studentName": "Олег Старцев",
        "studentCF": "nan",
        "studentRank": "nan"
    },
    "3": {
        "studentName": "Николай Галаев",
        "studentCF": "Sp1ritGhost",
        "studentRank": "754"
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question