Created
January 16, 2020 21:28
-
-
Save patmandenver/4d0cabdfe6e2306dc4e6f49fe663706b to your computer and use it in GitHub Desktop.
simple beginner openpyxl example
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
#!/usr/bin/env python3 | |
import openpyxl | |
from openpyxl import Workbook | |
############################################# | |
# MAIN | |
############################################# | |
if __name__ == '__main__': | |
wb = Workbook() | |
# grab the active worksheet | |
ws_01 = wb.active | |
#Set the title of the worksheet | |
ws_01.title = "First Sheet" | |
#place a few values in | |
ws_01['A1'] = 1 | |
ws_01['B2'] = 2 | |
ws_01['C3'] = 3 | |
#Save it in an Excel fie | |
wb.save("test_01.xlsx") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment