Jun-23-2020, 03:51 PM
Hi guys,
I would like to copy/paste some things in excel files BUT with keeping current format of the file.
The original file is in .xls and it has some macro inside of it.
While i run the code, it does the job and save it to .xlsx, however it loses completely format and macros.
What can i do to do this task and to keep the file format?
I would like to copy/paste some things in excel files BUT with keeping current format of the file.
The original file is in .xls and it has some macro inside of it.
While i run the code, it does the job and save it to .xlsx, however it loses completely format and macros.
What can i do to do this task and to keep the file format?
import pandas as pd excel = pd.read_excel(PATH\Original_file.xls, header=None) writer = pd.ExcelWriter(PATH\Test.xlsx", engine='xlsxwriter') left_values = excel.loc[6:21, 16:22] right_values = excel.loc[6:21, 30:36] right_values = left_values excel.to_excel(writer, 'sheet1', index=False, header=False)In the attachment there is part of the original excel file