Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Get sheet by name
- sheet = wb.get_sheet_by_name('Sheet1')
- Is now....
- sheet = wb['Sheet1']
- +++++++++++++++++++++++++++++
- Get sheet names
- wb.sheetnames
- +++++++++++++++++++++++++++++
- Get column LETTER
- c.column
- Is now....
- c.column_letter
- +++++++++++++++++++++++++++++
- Converting Between Column Letters and Numbers
- Import the following:
- from openpyxl.utils import get_column_letter
- from openpyxl.utils import column_index_from_string
- Commands:
- get_column_letter() - If you put in 1, you get A which is the first column.
- column_index_from_string() - If you put in A, you get 1 which is the first column.
- https://stackoverflow.com/questions/42913514/openpyxl-version-2-4-5-typeerror-generator-object-has-no-attribute-getitem/42913663#42913663
- +++++++++++++++++++++++++++++
- Accessing one column:
- sheet['(Column Letter)']
- x = sheet['B']
- print(x)
- +++++++++++++++++++++++++++++
- Removing a worksheet
- wb.remove_sheet(wb.get_sheet_by_name('Sheet Name'))
- is Now...
- del wb['Sheet name']
- +++++++++++++++++++++++++++++
- +++++++++++++++++++++++++++++
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement