I've been referring many articles and tried many code snippet, but not able to achieve. openpyxl package insert_rows is not working.
import openpyxl
wb = openpyxl.load_workbook('sample.xlsx')
sheet = wb['Sheet1']
sheet.insert_rows(idx=1, amount=3)
It should work, It will "Insert row or rows before row==idx" Try this:
import openpyxl
wb = openpyxl.load_workbook('sample.xlsx')
sheet = wb['Sheet1']
sheet['A1']=10
sheet.insert_rows(idx=0, amount=3)
wb.save('sample.xlsx')
Now the value 10 will move to D1.