Jun-28-2021, 09:42 AM
You can, and save in place, but that's not the proper way to do it because if you make a mistake, you will have overwritten you original spreadsheet.
Instead save to a new spreadsheet and when satisfied, you can rename it.
Example:
Instead save to a new spreadsheet and when satisfied, you can rename it.
Example:
from openpyxl import load_workbook excelfile = 'runways.xlsx' # modify to your spreadsheet name excelout = 'ModifiedRunways.xlsx' # ditto wb = load_workbook(excelfile) sheet_ranges = wb['runways'] # modify to your sheet name print(sheet_ranges['F2'].value) sheet_ranges['F2'] = 'New Guy' wb.save(excelout)