Saving dictionary data in Excel file with Python (2023-09-24 23:24:57)

Excel is one of the most important and widely used software in the field of information storage and processing. Using the features of this software can greatly facilitate the speed of searching, processing and even drawing the necessary data charts.

این چیه؟

In the following script, using the openpyxl library, we save the information stored in a dictionary in an Excel file sheet.

from openpyxl import Workbook
wb = Workbook()
ws = wb.active
sheet = wb.create_sheet("Countries",0)
dataDic={
    'A1':'Iran',
    'A2':'Turkey',
    'A3':'Azerbaijan',    
}
for item in dataDic:
    sheet[item]=(dataDic[item])
wb.save("CountriesList.xlsx")


Comments


Inchieh is both an idea and a learning challenge for us (and of course for anyone who wants to be with us). The purpose of the idea can be seen from its name. You are supposed to say what each picture is. فارسی