Created
May 18, 2020 07:10
-
-
Save mithunkamat/a553a81dc96f331b81c5eaeacb131aab to your computer and use it in GitHub Desktop.
Snippet showing how to set a tab called 'Mapping' as the active sheet with openpyxl.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first we set the path to Excel file | |
path = r".\documents\tool_setup.xlsx" | |
# open the file as a workbook object | |
wb = openpyxl.load_workbook(path, data_only=True) | |
# find the index of 'Mapping' sheet | |
idx = [i for i, name in wb.sheetnames if name == 'Mapping'][0] | |
# set the mapping sheet as active | |
wb.active = idx | |
ws = wb.active |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment