Second version:
Things todo:
- take lastline instead of firstline
- get value from lastline
Maybe you could code the points above yourself:
Things todo:
- take lastline instead of firstline
- get value from lastline
Maybe you could code the points above yourself:
#!/usr/bin/python3 import openpyxl as xls # open xls wb = xls.load_workbook(filename="sample.xlsx", data_only=True) ws = wb.active # read data in E2 for filename filename = str(ws["E2"].value) + ".txt" print(filename) with open(filename) as file: lines = file.readlines() lastline = lines[0].strip() #todo: lastline print(lastline) # replace data ws["G2"] = lastline #todo extract value wb.save("sample2.xlsx")