0

Python でリモート サーバーのフォルダー内のすべての Excel ファイルを処理するプログラムを作成する必要があります。私のコンピューターでExcelファイルを処理するには、使用します

from xlrd import open_workbook
book = open_workbook( filename)

次に処理しますbook ただし、リモートサーバーで処理するExcelファイルを取得する方法がわかりません。それを手伝ってください。可能であれば、リモート サーバーのフォルダー内のすべての Excel ファイルを取得する方法を教えてください。どうもありがとう。

4

1 に答える 1

0
import os

excelfiles = []

for cwd, folders, files in os.walk(starting_directory):  # For file in starting_directory
    for filename in files:
        path = os.path.join(cwd, filename)
        if os.path.splitext(path)[1].lower() == '.xls':  # If the file ends in '.xls'
            excelfiles.append(path)

for spreadsheet in excelfiles:
    process_spreadsheet(spreadsheet)
于 2013-01-08T02:05:15.630 に答える