xlwings - 删除一系列行
xlwings - Delete a range of rows
我似乎无法找到一种方法来删除从第 x 行开始到 sheet
底部的一系列行
例如 VBA 我会做的代码
Rows(CStr(currRow) & ":65536").Select
Selection.Delete Shift:=xlUp
其中 currRow 可以是任何东西 - 即我不一定要删除 sheet
中的所有内容
xlwings 中是否有等效项?
有空缺 issue to take care of that. In the meantime, as usual, you can work around as explained in the docs。
在您的情况下,应该执行类似以下操作(使用 v0.9 语法):
import xlwings as xw
from xlwings.constants import DeleteShiftDirection
sht = xw.sheets.active
sht.range(str(currRow) + ':65536').api.Delete(DeleteShiftDirection.xlShiftUp)
我似乎无法找到一种方法来删除从第 x 行开始到 sheet
底部的一系列行例如 VBA 我会做的代码
Rows(CStr(currRow) & ":65536").Select
Selection.Delete Shift:=xlUp
其中 currRow 可以是任何东西 - 即我不一定要删除 sheet
中的所有内容xlwings 中是否有等效项?
有空缺 issue to take care of that. In the meantime, as usual, you can work around as explained in the docs。
在您的情况下,应该执行类似以下操作(使用 v0.9 语法):
import xlwings as xw
from xlwings.constants import DeleteShiftDirection
sht = xw.sheets.active
sht.range(str(currRow) + ':65536').api.Delete(DeleteShiftDirection.xlShiftUp)