Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

im trying to make an automatic work scheduler in python, by reading an excel file and then making a schedule from it. my code: my

im trying to make an automatic work scheduler in python, by reading an excel file and then making a schedule from it.
my code: image text in transcribed
my input: (and what i want it to look like in "expected output")
image text in transcribed
what output i am getting.
image text in transcribed
i want the names of people working on that specific day like a schedule.
can you fix my code, or make a code that reads an excel file and outputs a work schedule for the week.
import openpyxl \# Open the workdays spreadsheet workdays_wb = openpyx l. load_workbook( 'workdays. x 'sx') workdays_sheet = workdays_wb.active \# Create a new schedule spreadsheet schedule wb = openpyxi. Workbook() schedule_sheet = schedule_wb. active schedule_sheet.title = "Schedule" \# Write the header row for the schedule schedule_sheet [ A1]]= "Monday" schedule_sheet [ 'B1 ' ]= "Tuesday" schedule_sheet [ 'C1' ]= "Wednesday" schedule_sheet [ DD ' ] = "Thursday" schedule_sheet ['E1'] = "Friday" \# Iterate through the workdays spreadsheet and write the schedule for row in range (2, workdays sheet,max row +1) : name = workdays sheet, cell (row=row, column=1), value monday = workdays sheet, cell(row=row, column=2), value tuesday = workdays sheet, cell(rowerow, column=3), value wednesday = workdays sheet. cell thursday = workow, column=4), value friday = workdays sheet. cell (row=row, column=5), value friday = workdays,sheet. cell( rowerow, column=6), value schedule_sheet, cell(rowerow, column=1) :value = name if monday else m schedule_sheet, cell(row=row, column=2), value = name if tuday else schedule_sheet. cell(rownow, column=3), value = name if wednesday else "n schedule_sheet, cell(row=row, column=4), value = name if thursday else wu schedule_sheet, cell(rowerow, column=5), value a name if friday else wn \# Save the schedule spreadsheet schedule,wb. save("schedule. x (sx") \begin{tabular}{|l|l|c|c|c|c|c|c|} \hline \multicolumn{1}{|c|}{ A } & B & C & D & E & F & G \\ \hline 1 & Monday & Tuesday & Wednesday Thursday & Friday & & \\ \hline 2 & Name1 & Name1 & Name1 & Name1 & Name1 & & \\ \hline 3 & Name2 & Name2 & Name2 & Name2 & Name2 & & \\ \hline 4 & & & & & & & \\ \hline 5 & & & & & & & \\ \hline \end{tabular}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions