Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 如何插入新行-xlwings_Excel_Python 3.x_Xlwings - Fatal编程技术网

Excel 如何插入新行-xlwings

Excel 如何插入新行-xlwings,excel,python-3.x,xlwings,Excel,Python 3.x,Xlwings,我试图实现的是在当前Excel表单中扩展表的长度(不附加到整个电子表格的底部),同时不替换表下的内容 为此,我想插入新行(例如第30行)如何使用xlwings实现这一点?我找到了实现这一点的方法。不幸的是,xlwings似乎没有内置的功能,但可以使用API实现 以下是我插入新行的方式: sht.range("30:30").api.Insert(InsertShiftDirection.xlShiftToRight) 请注意,现在只需执行sht.range(“30:30”).insert()(

我试图实现的是在当前Excel表单中扩展表的长度(不附加到整个电子表格的底部),同时不替换表下的内容


为此,我想插入新行(例如第30行)如何使用xlwings实现这一点?

我找到了实现这一点的方法。不幸的是,xlwings似乎没有内置的功能,但可以使用API实现

以下是我插入新行的方式:

sht.range("30:30").api.Insert(InsertShiftDirection.xlShiftToRight)
请注意,现在只需执行
sht.range(“30:30”).insert()
(默认值为下移)。