def tableau_data():
    Workbook.caller()

    save_path = str(dr_pivot_path())
    save_path = save_path[:save_path.rindex('\\')]

    ddr_data = dr.raw_pivot()

    d = dr.tableau_campaign_data(ddr_data)
    s = search.merge_data()

    tableau = d.append(s)
    tableau['Quarter'] = qquarter()

    if Range('merged', 'A1').value is None:
        chunk_df(tableau, 'merged', 'A1')

    # If data is already present in the tab, the two data sets are merged together and then copied into the data tab.
    else:
        past_data = pd.read_excel(dr_pacing_path(), 'merged', index_col=None)
        past_data = past_data[past_data['Campaign'] != 'Search']
        appended_data = past_data.append(tableau)
        Sheet('merged').clear()
        chunk_df(appended_data, 'merged', 'A1')

    #Range('Sheet3', 'AT1').value = pd.to_datetime(ddr_data['Date'].max()) + datetime.timedelta(days= 1)

    wb = Workbook()
    Sheet('Sheet1').name = 'DDR Data'

    chunk_df(ddr_data, 'DDR Data', 'A1')

    wb.save(save_path + '\\' + 'DR_Raw_Data.xlsx')
    wb.close()
def output_pacing_data_for_forecasts():
    wb = Workbook.caller()

    dr_data = dr.raw_pivot()
    #pace = dr.pacing()

    #data_merged = data_transform.raw_pacing_and_dr(dr_data, pace)

    dr_forecasting = data_transform.transform_dr(dr_data)
    wb.set_current()

    Sheet('raw_pacing_data').clear_contents()
    Range('raw_pacing_data', 'A1', index=False).value = dr_forecasting

    performance.publishers(dr_data)