如何导入多个Excel文件并使用openpyxl合并它们

时间:2018-01-03 00:01:15

标签: python excel pandas csv openpyxl

如何导入muleiple excel文件并使用openpyxl合并它们 我到目前为止的代码就是这个......

from openpyxl import Workbook

def Test (filepath, yaml_sheetname):
    assumed_cell = "A1"
    wb = openpyxl.load_workbook('/Users/c1carpenter/Desktop/Test.xlsx')
    wb = openpyxl.load_workbook('/Users/c1carpenter/Desktop/Test2.xlsx')                             
    sheet_names = wb.get_sheet_names()

    if 'metadata' not in sheet_names:
    error_msg = "{0}'{1}' .".format(NON_WIZARD_XLSX_ERROR_PREFIX, filepath)
    raise ValueError(error_msg)

    yaml_sheet = wb[yaml_sheetname]
    yaml_string = yaml_sheet[assumed_cell].value

    print(yaml_string)    

0 个答案:

没有答案