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
wb = Workbook()
wb.save("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
- We can add new worksheets to a given workbook with the
- To delete a worksheet, we can either use the
del wb["Second sheet"] or the
- Creating a copy of a given worksheet requires the
copy_worksheet() method. However:
- 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_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!