简体   繁体   中英

How to copy excel sheet to another workbook with same format using python

I have to copy the excel sheets from different source files to destination sheets with same format(Headers, Borders, Fonts, Formulas, Background color, Spacing, ... etc)

I have tried below script but it is copying only data also, header is not exactly matched.

import pandas as pd

df = pd.read_excel(src, sheet_name="Sheet1")

df.to_excel(des, sheet_name='new_tab')

Any help is appreciated. Preferable Python.

I don't think that this is possible with pandas. You should probably have a look at VBA and write a macro for it, though i can say writing vba is not fun at all compared to python.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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