Saving dictionary data in Excel file with Python (انتشار: 1402/07/02)

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")


نظرات خوانندگان نوشته


نظری در این مورد دارید؟ خوشحال می‌شیم اون رو برامون ارسال کنید.