import os
import datetime
import time
import numpy as np
import pandas as pd
yesterday_date = (datetime.datetime.today() - datetime.timedelta(days=1)).strftime('%Y-%m-%d')
for name in os.listdir('D:\Test'):
full_name = os.path.join('D:\Test', name)
if time.strftime('%Y-%m-%d', time.localtime(os.path.getmtime(full_name))) == yesterday_date:
folder_name_path = 'D:\Test\\' + name
filename_path = folder_name_path + '\\' + 'mentionfilename'
from openpyxl.workbook import Workbook
df = pd.read_excel(r'C:\Users\Desktop\testing_today.xlsx')
df_old = pd.read_excel(filenamepath)
df_new=df.merge(df_old[['mtm','wes','fre']],on='mtm')
writer =pd.ExcelWriter(r'C:\Users\Desktop\output.xlsx')
df_new.to_excel(writer,'Sheet1')
writer.save()