[英]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.