繁体   English   中英

在python中处理远程服务器中文件夹中的所有excel文件

[英]process all excel files in a folder in a remote server in python

我需要编写一个程序来处理Python中远程服务器的文件夹中的所有excel文件。 要在计算机上处​​理Excel文件,我使用

from xlrd import open_workbook
book = open_workbook( filename)

然后处理book但是,我不知道如何在远程服务器上获取excel文件进​​行处理。 请帮我。 如果可能的话,请告诉我如何在远程服务器的文件夹中获取所有excel文件。 非常感谢。

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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM