Skip to content

Instantly share code, notes, and snippets.

@patmandenver
Created January 16, 2020 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patmandenver/4d0cabdfe6e2306dc4e6f49fe663706b to your computer and use it in GitHub Desktop.
Save patmandenver/4d0cabdfe6e2306dc4e6f49fe663706b to your computer and use it in GitHub Desktop.
simple beginner openpyxl example
#!/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