LoginSignup
1
0

More than 3 years have passed since last update.

Pythonでフォルダ内の日付順に管理されたExcelファイルの最新データを開いてみた

Posted at
import subprocess
import glob
import pathlib

def findOpen(url, fil):
        share = pathlib.WindowsPath(url)
        try:
                if share.exists():
                        path = ''
                        print(url)
                        for x in share.glob(fil):
                                print(x)
                                path = str(x)
                        if path != '':
                                print('Open : ' + path)
                                subprocess.Popen(['start','', path], shell=True)
        except:
                import traceback
                traceback.print_exc()
                input("Press Enter to continue...")

url = r'C:\\フォルダ'
fil = '[!(~$)]*ファイル名.xls?'

findOpen(url,fil)
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0