Created
June 17, 2019 10:14
-
-
Save evanmiltenburg/2cf6adf7d9af55a5bda965be0b576eae to your computer and use it in GitHub Desktop.
Generate an Excel worksheet to provide word-level annotations
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
import xlsxwriter | |
# Create workbook with a new worksheet. | |
workbook = xlsxwriter.Workbook('hello.xlsx') | |
worksheet = workbook.add_worksheet() | |
# Write the tokens. | |
worksheet.write('A1', 'Hello') | |
worksheet.write('B1', 'world') | |
worksheet.write('C1', '!') | |
# Define options to choose from. | |
options = ['A', 'B', 'C'] | |
# Insert the dropdown menu: | |
for cell in ['A2','B2','C2']: | |
worksheet.data_validation(cell, {'validate': 'list', 'source': options}) | |
# Write out the data, and close. | |
workbook.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment