USE MODULE openpyxl
Only supports xlsx format (Not xls format)
# Import Workbook module (.py file) from package openpyxl and Import calendar module directly
from openpyxl import Workbook
import calendar
# Create a workbook object
wb = Workbook()
# Create 12 sheets for each month in workbook
i=0
for month in calendar.month_name:
if not(len(str(month)) == 0):
print(month)
wb.create_sheet(month+"_2017", i)
i = i + 1
# Write to file
filePath = "Hello.xlsx"
wb.save(filePath)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.