import xlwings as xw

path = r"D:\projects\wordpress\ex428\list_of_files.txt"

with open(path, 'r') as fp:
    filepaths = fp.readlines()

sheet='Flight'
for filepath in filepaths:
    filepath=filepath.strip()
    file = filepath
    wb=xw.Book(file)
    ws = wb.sheets[sheet]
    v1 = ws.range("F6").value
    v2 = ws.range("F7").value
    v3 = ws.range("F8").value
    v4 = ws.range("F9").value
    wb.app.quit()
    vmax=max(v1,v2,v3,v4)
    print(file)
    print("vmax", vmax)

Output:

D:\projects\wordpress\ex428\ex428.xlsx
vmax 16.0
D:\projects\wordpress\ex428\ex428_1.xlsx
vmax 16.0
D:\projects\wordpress\ex428\ex428_2.xlsx
vmax 16.0

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading