Good job! Now, if we print a cell from the
calendar worksheet, we see something similar to:
This means we've accessed the A1 cell in the
calendar worksheet. But we can"t see the contents of the cell. How do we go about accessing cell contents?
We can access the
value property in the same way we've accessed the
title property of a worksheet. Let's go back to
sweets_ws for this. Suppose we've already selected our cell, A1. We can then use
cell.value to acquire the value held in that particular cell:
When accessing a cell value, it's important to note that
openpyxl automatically converts the value of the given cell to the appropriate data type. For example, if the value in A1 is the number
1.000, Python will automatically treat that value as an integer.