Apr-07-2020, 06:25 PM
Hey people
I'm new with Python programming so I don't know much. I have a problem with coping a range of cells with formatting but in reverse order(to mirror it precisely). This table represents the front and back of the 2 sided sheet when you look at them. I have the left range(always the same) formatted in a way that I need. So I will change the color and numbers. I want to get the second table next to this one but mirrored. Something like this https://ibb.co/0hHSk28.
Below is my code.
I'm new with Python programming so I don't know much. I have a problem with coping a range of cells with formatting but in reverse order(to mirror it precisely). This table represents the front and back of the 2 sided sheet when you look at them. I have the left range(always the same) formatted in a way that I need. So I will change the color and numbers. I want to get the second table next to this one but mirrored. Something like this https://ibb.co/0hHSk28.
Below is my code.
import openpyxl as xl def process_workbook(filename): wb = xl.load_workbook(filename) sheet = wb.active mr = sheet.max_row mc = sheet.max_column for i in range(2, mr + 1): for j in reversed(range(2, mc + 1)): cell = sheet.cell(row=i, column=j) sheet.cell(row=i, column=j+11).value = cell.value wb.save('henkel.xlsx') filename = 'henkel.xlsx' process_workbook(filename)