0

I tried many approaches from last few hours but no luck. Somebody please help me.

group_dt = pt.PivotFields('Created')
group_dt.LabelRange.Group(Start=True, End=True, Periods=Array(False, False, False, False, True, False, True))

Error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-75-0355ab1abb88> in <module>
      1 group_dt = pt.PivotFields('Created')
----> 2 group_dt.LabelRange.Group(Start=True, End=True, Periods=Array(False, False, False, False, True, False, True))

TypeError: 'str' object is not callable
Zoe
  • 27,060
  • 21
  • 118
  • 148

1 Answers1

0

After a lot of research I have figured out the way to group date field using win32com.client

cell = pivot_sheet.Range('B5')
cell.Group(Start=True, End=True, Periods=list([False, False, False, False, True, False, True]))