Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Working with Excel Files
12. Summary


Well done! Let summarize everything we've learned in this part:

  • We can create a new workbook with the Workbook() object and save its contents to a file with the save() method:
    wb = Workbook()"Very important file.xlsx")
    Remember that if you choose a file name that's already in use, save() will overwrite the existing file.
  • Every workbook is created with one default worksheet named "Sheet".
  • We can add new worksheets to a given workbook with the create_sheet() method:
    wb.create_sheet("Second sheet")
  • To delete a worksheet, we can either use the del keyword:
    del wb["Second sheet"]
    or the remove() method:
    wb.remove(wb["Second sheet"])
  • Creating a copy of a given worksheet requires the copy_worksheet() method. However:
    • We have to pass the worksheet we want to copy into the method:
      ws =
    • We cannot copy worksheets between different workbooks.
  • To change the value of a given cell, we can simply assign it data:
    ws["A1"] = "13:00"
  • If we want to append a whole row instead of modifying single cells, we can use the append() method, passing the list of values as an argument:
    row = ["15:00", "Club meeting"]
  • We can delete rows and columns from our worksheet with the delete_rows() or delete_cols() methods, passing the row number or column index number as an argument:

Before we try the final quiz for this course, let's do some review exercises!


Click Next exercise to continue.