title: How to create and edit timeline slicer using win32com python?
body: <p>I am trying to create a timeline slicer using win32com python. I am currently using win32com to manipulate excel data but in the data, my client wants me to set the upper limit and lower limit of the timeline slicer to certain month. I have googled a lot and i have came to a conclusion that the only way I could do it is by coding it in VBA and implement it in python like <a href="https://stackoverflow.com/questions/19505676/use-python-to-write-vba-script">here</a>. I have no experience in VBA and I was wondering if there is a way to use win32com python instead of VBA win32com python.</p>
  <p><strong>Edit:</strong></p>
  <p>After using &quot;Assign Macro&quot; in Excel, this is the code regarding my timeslicer:</p>
  <pre><code>ActiveWorkbook.SlicerCaches(&quot;NativeTimeline_Goods_Receipt_Date&quot;).TimelineState. _
          SetFilterDateRange &quot;01/01/2020&quot;, &quot;30/04/2020&quot;
  </code></pre>
  <p>Now i need to change it into python and assign the start date &amp; end date into variable. So far i have this:</p>
  <pre><code>from win32com.client import Dispatch
  excel = win32.gencache.EnsureDispatch('Excel.Application')
  test_wb = excel.Workbooks.Open(test_file)
  date_sl = test_wb.SlicerCaches(&quot;NativeTimeline_Goods_Receipt_Date&quot;)
  </code></pre>