1

I am unable to find any suitable method to copy visible data{only filtered data} from one excel workbook to another workbook using Pywin32 com. I tried using .Range("B:B").SpecialCells(xlCellTypeVisible).Copy ,VBA method, but its not supported in pywin32,it seems .

I get below error when trying with xlCellTypeVisible:

NameError: name 'xlCellTypeVisible' is not defined

Any help/hint is much appreciated .

De Novo
  • 7,120
  • 1
  • 23
  • 39
R M
  • 46
  • 4

1 Answers1

0

This is probably because Python is looking for a local variable called xlCellTypeVisible and doesn't find one. The value of xlCellTypeVisible is 12 according to the documentation. Try using .SpecialCells(12)

EDIT: You can also import the constants using from win32com.client import constants as c using the method mentioned in this answer. Then you could use c.xlCellTypeVisible

starwarswii
  • 2,187
  • 1
  • 16
  • 19