Locked lesson.
About this lesson
Just like iterating through rows, we can also iterate through columns.
Exercise files
Download this lesson’s related exercise files.
21 - Existing Excel - Iterate Thru Columns.docx60.4 KB 21 - Existing Excel - Iterate Thru Columns SOLUTION.docx
57.8 KB
Quick reference
Existing Excel - Iterate Thru Columns
Just like iterating through rows, we can also iterate through columns.
When to use
Use this method when you want to iterate through columns with more control.
Instructions
for col in ws.iter_cols(min_row=1, max_row=4, max_col=1, max_col=2, values_only=True):
print('\n')
for cell in col:
print(cell)
Hints & tips
- for col in ws.iter_cols(min_row=1, max_row=4, max_col=1, max_col=2, values_only=True):
Lesson notes are only available for subscribers.