Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import openpyxl
- import concurrent.futures
- DIR = "15% SEEPAGE"
- files = os.listdir(DIR)
- def format_excel_file(path):
- wb = openpyxl.load_workbook(path)
- # Deleting Sheet 1
- del wb["Sheet1"]
- ws = wb["Sheet2"]
- # Deleting first two rows
- ws.delete_rows(1, 2)
- # Renaming Columns
- ws.cell(row=1, column=1).value = "T"
- ws.cell(row=1, column=2).value = "U"
- ws.cell(row=1, column=3).value = "V"
- ws.cell(row=1, column=4).value = "W"
- # Renaming Sheet2 to Sheet1
- ws.title = "Sheet1"
- wb.save(path)
- print(f"Updated file: {path}")
- for file in files:
- path = os.path.join(DIR, file)
- format_excel_file(path)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement