I've a input excel with 4 columns. Step1: To add a new column (col 5) Step2 : Drag the formula from col 4 to col 5.
If you see here I got col 'D' from col 'C'
Similarly col 'C' using col 'B'
Now I just want to create a new col using col 'D'. Output should look like below.
I want to automate this using python.
Things I tried. I tried the autofill method in xlwings, but it only works from top to bottom cells. Like E2:E7. I want to fill D2:E2 first and then E2:E7 is easy using the below code.
import xlwings as xw
from xlwings.constants import AutoFillType
wb = xw.Book(r'C:\Users\Sandeep\Downloads/FormulaDragTest.xlsx')
sheet = wb.sheets(1)
sheet.range('E2').api.AutoFill(sheet.range("E2:E7")).api,
AutoFillType.xlFillDefault)