Created
April 22, 2016 20:38
-
-
Save tnhu/33a762d8c76aad25189114dffd9df6a8 to your computer and use it in GitHub Desktop.
Open and Edit an Excel template using Python's openpyxl library
This file contains 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
from openpyxl import load_workbook | |
wb = load_workbook('template.xlsx') | |
# grab the active worksheet | |
ws = wb.active | |
# Data can be assigned directly to cells | |
ws['A2'] = 'Tom' | |
ws['B2'] = 30 | |
ws['A3'] = 'Marry' | |
ws['B3'] = 29 | |
# Save the file | |
wb.save("sample.xlsx") |
how can we insert the data using row and column number ?
how can we insert the data using row and column number ?
sheet.cell(row=row, column=col).value = 'value'
Thanks a million!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Extremely Thanks