如何使用 xlwings 在 Excel 中复制和粘贴过滤后的 table
How to copy and paste a filtered table in Excel using xlwings
我正在尝试仅将过滤后的 Excel table 的可见数据复制到另一个范围。到目前为止我的代码如下所示:
import xlwings as xw
wb = xw.Book('Test Report.xlsx')
sht=wb.sheets('Sheet1')
sht.range('Table1').api.SpecialCells(12).copy
这是复制,我可以看到 table 周围的虚线,但是我不知道如何将其粘贴到其他地方。
好的,只是想这样做:
import xlwings as xw
wb = xw.Book('Test Report.xlsx')
sht=wb.sheets('Sheet1')
sht.range('Table1').api.SpecialCells(12).copy
sht.range('P2').select()
sht.api.paste
sht.api.Application.CutCopyMode=0
我正在尝试仅将过滤后的 Excel table 的可见数据复制到另一个范围。到目前为止我的代码如下所示:
import xlwings as xw
wb = xw.Book('Test Report.xlsx')
sht=wb.sheets('Sheet1')
sht.range('Table1').api.SpecialCells(12).copy
这是复制,我可以看到 table 周围的虚线,但是我不知道如何将其粘贴到其他地方。
好的,只是想这样做:
import xlwings as xw
wb = xw.Book('Test Report.xlsx')
sht=wb.sheets('Sheet1')
sht.range('Table1').api.SpecialCells(12).copy
sht.range('P2').select()
sht.api.paste
sht.api.Application.CutCopyMode=0