1"""
2Enter the following command `sudo pip install openpyxl
3if this doesn't work download openpyxl zip file from
4https://pypi.org/project/openpyxl/
5after that extract it and then open the folder in terminal and write
6`sudo python setup.py install`
7
8""""
9import openpyxl
10try:
11 path = "pathOfxlsFile/filename.xls"
12 wb_obj = openpyxl.load_workbook(path.strip())
13 # from the active attribute
14 sheet_obj = wb_obj.active
15 # get max column count
16 max_column = sheet_obj.max_column
17 max_row = sheet_obj.max_row
18 print(f"\n\n coulumns {max_column} \n\n")
19 print(f"\n\n rows{max_row} \n\n")
20 for j in range(1,max_row):
21 #count starts form 1, don't use 0
22 cellThatIsToBeChanged = sheet_obj.cell(row=j, column=1)
23 cellThatIsToBeChanged.value = 'new modified value'
24 wb_obj.save('fileName.xlsx')
25 except Exception as e:
26 print(e)