1.  Use Sorted with a key for getmtime
  2. pop off the last one and that is your file
import os,glob

my_xlsm = sorted(glob.glob(r"C:\Users\jibsheet\Downloads\Sample*.xlsm"), key=os.path.getmtime )

latest_xlsm = my_xlsm.pop()

 

Leave a Reply