- 插入行、列
插入行的函数是insert_rows(index,amount)。其中index是起始的行,从1开始计数。而amount是要插入多少行。这些行都是空白的。
插入列也是类似,用insert_cols()
import openpyxl as pyxl
file_name = "abc.xlsx"
wb = pyxl.load_workbook(file_name)
ws = wb.active
ws.insert_rows(2,3)
ws.insert_cols
import openpyxl as pyxl
file_name = "abc.xlsx"
wb = pyxl.load_workbook(file_name)
ws = wb.active
ws.insert_rows(2,3)
ws.insert_cols