Write a Python program to access the Furniture spreadsheet, update the price of tables, and then create a new excel spreadsheet called updatedfurniture. Create a dictionary for the price updates and update the prices via a loop, increasing the row number to include all the rows in the spreadsheet. Do not change the formatting of the original spreadsheet. Be sure to check your updatedFurniture spreadsheet to verify that the Total price of the furniture increased. The new Total price amount should be $273,938.20.
import openpyxl
from pathlib import Path
data = {}
data['dict1'] = {}
ex_file = Path(Path.home(), 'FormaterPythonUniversity', 'Template.xlsx')
#here you will add your data with your numbers
wb_obj = openpyxl.load_workbook(ex_file)
# Read the active sheet:
sheet = wb_obj.active
for i, row in enumerate(sheet.iter_rows(values_only=True)):
data['Full Name'] = row[0]
print(row[0])
data['dict1']['Work email address'] = row[1]
data['dict1']['Start date'] = row[2]
data['dict1']['Manager name'] = row[3]
data['dict1']['Manager email address'] = row[4]
data['dict1']['Category'] = row[5]
uptated = data["dict1"]["ctaegory"] = 273938.20
print(data)
Comments
Leave a comment