diff --git a/.github/workflows/months_end.yml b/.github/workflows/months_end.yml index e316b3d..758045b 100644 --- a/.github/workflows/months_end.yml +++ b/.github/workflows/months_end.yml @@ -2,6 +2,7 @@ name: Months End on: # schedule: # # - cron: '0 17 * * 1-5' + #adslfhjk asdlfjldsakjf push: branches: [main, feature/month_end_automation_of_all] workflow_dispatch: @@ -27,5 +28,16 @@ jobs: pwd ls -la poetry run python etl/month_end_automation_wave_2_layout.py + poetry run python etl/month_end_automation_wave_2_no_3.py + poetry run python etl/month_end_automation_wave_2_no_4.py + poetry run python etl/month_end_automation_wave_2_no_5.py + poetry run python etl/month_end_automation_wave_2_no_6.py + poetry run python etl/month_end_automation_wave_2_no_7.py + poetry run python etl/month_end_automation_wave_2_no_8.py + poetry run python etl/month_end_automation_wave_2_no_9.py + poetry run python etl/month_end_automation_wave_2_no_10.py + poetry run python etl/month_end_automation_wave_2_no_11.py + poetry run python etl/month_end_automation_wave_2_no_12.py + poetry run python etl/month_end_automation_wave_2_no_13.py env: PYTHONPATH: ${{ github.workspace }} \ No newline at end of file diff --git a/etl/month_end_automation_wave_2_no_10.py b/etl/month_end_automation_wave_2_no_10.py index d854fdc..9b7b3e7 100644 --- a/etl/month_end_automation_wave_2_no_10.py +++ b/etl/month_end_automation_wave_2_no_10.py @@ -1,10 +1,12 @@ # Wave 2's month end automation +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -204,5 +206,17 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'NCHA Derbyshire Dales (DDDCC) SHDF_{timestamp}.xlsx', index=False) +master_folder_name = "NCHA Derbyshire Dales (DDDCC) SHDF" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_11.py b/etl/month_end_automation_wave_2_no_11.py index 41f4438..874eaa3 100644 --- a/etl/month_end_automation_wave_2_no_11.py +++ b/etl/month_end_automation_wave_2_no_11.py @@ -1,10 +1,12 @@ # Wave 2's month end automation +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -198,5 +200,17 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'Northumberland LAD2 & HUG2_{timestamp}.xlsx', index=False) +master_folder_name = "Northumberland LAD2 & HUG2" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_12.py b/etl/month_end_automation_wave_2_no_12.py index 7fa4c1a..464d211 100644 --- a/etl/month_end_automation_wave_2_no_12.py +++ b/etl/month_end_automation_wave_2_no_12.py @@ -1,10 +1,12 @@ # Wave 2's month end automation +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -149,13 +151,13 @@ full_lodgement = get_df(df, "tm ph2 invoice status".lower(), ["to invoice"], "Fu filtered_dfs.append(full_lodgement) # POST EPC -post_epc = get_df(df, "post-epc status", ["uploaded", "completed"], "POST EPC") +post_epc = get_df(df, "post-epc epr status", ["uploaded", "completed"], "POST EPC") filtered_dfs.append(post_epc) # POST EPR post_epr = df[ - df["post-epc status"].str.lower().isin(["post epr completed"]) + df["post-epc epr status"].str.lower().isin(["post epr completed"]) ].copy() post_epr["job_type"] = "POST epr" filtered_dfs.append(post_epr) @@ -203,5 +205,17 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'Shropshire Council HUG2_{timestamp}.xlsx', index=False) +master_folder_name = "Shropshire Council HUG 2" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_13.py b/etl/month_end_automation_wave_2_no_13.py index d4a6a1d..7637222 100644 --- a/etl/month_end_automation_wave_2_no_13.py +++ b/etl/month_end_automation_wave_2_no_13.py @@ -1,10 +1,12 @@ # Wave 2's month end automation +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -196,5 +198,17 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'Stonewater SHDF 3.0 - Operations_{timestamp}.xlsx', index=False) +master_folder_name = "Stonewater SHDF 2.0 - Operations" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_3.py b/etl/month_end_automation_wave_2_no_3.py index b349a7a..2500d25 100644 --- a/etl/month_end_automation_wave_2_no_3.py +++ b/etl/month_end_automation_wave_2_no_3.py @@ -1,7 +1,8 @@ # Wave 2's month end automation - +import os from tqdm import tqdm from monday import MondayClient +from MonthEndUploader import upload_to_month_end_folder from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd @@ -230,5 +231,17 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'Platform Housing W2 (in use)_{timestamp}.xlsx', index=False) +master_folder_name = "Platform Housing W2 (in use)" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_4.py b/etl/month_end_automation_wave_2_no_4.py index 30b949f..1b7f6f4 100644 --- a/etl/month_end_automation_wave_2_no_4.py +++ b/etl/month_end_automation_wave_2_no_4.py @@ -1,11 +1,12 @@ # Wave 2's month end automation - +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -237,5 +238,18 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') + +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'Stonewater - (in use)_{timestamp}.xlsx', index=False) +master_folder_name = "Stonewater - (in use)" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_5.py b/etl/month_end_automation_wave_2_no_5.py index f26d3b0..c26834b 100644 --- a/etl/month_end_automation_wave_2_no_5.py +++ b/etl/month_end_automation_wave_2_no_5.py @@ -1,11 +1,12 @@ # Wave 2's month end automation - +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -229,5 +230,17 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'ECO 4 NCHA Almshouses Operations_{timestamp}.xlsx', index=False) +master_folder_name = "ECO 4 NCHA Almshouse Operation" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_6.py b/etl/month_end_automation_wave_2_no_6.py index 0ad996f..8091aa1 100644 --- a/etl/month_end_automation_wave_2_no_6.py +++ b/etl/month_end_automation_wave_2_no_6.py @@ -1,7 +1,8 @@ # Wave 2's month end automation - +import os from tqdm import tqdm from monday import MondayClient +from MonthEndUploader import upload_to_month_end_folder from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd @@ -205,3 +206,19 @@ timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') attribute = ['address', 'client', 'job_type', 'rate'] combined_with_rates[attribute].to_excel(f'ECO 4 Wates Operations_{timestamp}.xlsx', index=False) + + +# Upload to sharepoint +attribute = ['address', 'client', 'job_type', 'rate'] +master_folder_name = "ECO 4 Wates Operations" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_7.py b/etl/month_end_automation_wave_2_no_7.py index 214c233..e1fbf9c 100644 --- a/etl/month_end_automation_wave_2_no_7.py +++ b/etl/month_end_automation_wave_2_no_7.py @@ -1,11 +1,12 @@ # Wave 2's month end automation - +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -195,7 +196,7 @@ post_epr["job_type"] = "POST epr" filtered_dfs.append(post_epr) # Post ATT -post_att = get_df(df, "post att invoicing status ", ["to invoice"], "POST ATT") +post_att = get_df(df, "post att invoicing status", ["to invoice"], "POST ATT") filtered_dfs.append(post_att) @@ -236,6 +237,7 @@ rate_card_df_net_zero["job_type"] = rate_card_df_net_zero["job_type"].str.lower( rate_card_df_sp_plus["job_type"] = rate_card_df_sp_plus["job_type"].str.lower() rate_card_df_error_message["job_type"] = rate_card_df_error_message["job_type"].str.lower() + # Now perform the merge net_zero_df = final_df[final_df['client'].str.contains('shdf net zero'.lower(), case=False, na=False)] sp_plus_df = final_df[final_df['client'].str.contains('SHDF 2.0 SP+'.lower(), case=False, na=False)] @@ -247,11 +249,41 @@ combined_with_rates_other_from_home_group = other_df.merge(rate_card_df_error_me import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] combined_with_rates_sp_plus[attribute].to_excel(f'HomeGroup Wave 2SP+_{timestamp}.xlsx', index=False) combined_with_rates_net_zero_df[attribute].to_excel(f'HomeGroup Wave NetZero_{timestamp}.xlsx', index=False) combined_with_rates_other_from_home_group[attribute].to_excel(f'HomeGroup Wave Unsure_who_to_bill_{timestamp}.xlsx', index=False) +master_folder_name = "Home Group" -# TO DO check everything in excel -# make logic for seperation \ No newline at end of file +# Wave 2SP+ +file_name = f"{master_folder_name}_Wave 2SP+_{timestamp}.xlsx" +combined_with_rates_sp_plus[attribute].to_excel(file_name, index=False) +file_path = os.path.abspath(file_name) +upload_to_month_end_folder(file_name, file_path, master_folder_name) +invoice_name = "wave_2sp_plus_rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df_sp_plus.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) + + +# Net Zero +file_name = f"{master_folder_name}_NetZero_{timestamp}.xlsx" +combined_with_rates_net_zero_df[attribute].to_excel(file_name, index=False) +file_path = os.path.abspath(file_name) +upload_to_month_end_folder(file_name, file_path, master_folder_name) +invoice_name = "net_zero_rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df_net_zero.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) + +# Unsure +file_name = f"{master_folder_name}_unsure_who_to_bill_{timestamp}.xlsx" +combined_with_rates_other_from_home_group[attribute].to_excel(file_name, index=False) +file_path = os.path.abspath(file_name) +upload_to_month_end_folder(file_name, file_path, master_folder_name) +invoice_name = "unsure_who_to_bill_rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df_error_message.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_8.py b/etl/month_end_automation_wave_2_no_8.py index 0aff6fc..d465dd6 100644 --- a/etl/month_end_automation_wave_2_no_8.py +++ b/etl/month_end_automation_wave_2_no_8.py @@ -1,10 +1,12 @@ # Wave 2's month end automation +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -214,5 +216,18 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') + +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'NCHA SHDF 2.1 SBS_{timestamp}.xlsx', index=False) +master_folder_name = "NCHA SHDF 2.1 SBS" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name) diff --git a/etl/month_end_automation_wave_2_no_9.py b/etl/month_end_automation_wave_2_no_9.py index 15bf2fb..7d92c72 100644 --- a/etl/month_end_automation_wave_2_no_9.py +++ b/etl/month_end_automation_wave_2_no_9.py @@ -1,10 +1,12 @@ # Wave 2's month end automation +import os from tqdm import tqdm from monday import MondayClient from etl.osmosis_complaince_address_to_files import get_all_items, extract_asset_ids from pprint import pprint import pandas as pd import json +from MonthEndUploader import upload_to_month_end_folder monday_key = "eyJhbGciOiJIUzI1NiJ9.eyJ0aWQiOjQ5ODc2ODQxOCwiYWFpIjoxMSwidWlkIjozNjE3ODAzNCwiaWFkIjoiMjAyNS0wNC0xMVQxMToyMzoxNy40NjdaIiwicGVyIjoibWU6d3JpdGUiLCJhY3RpZCI6MTM5OTc4MjMsInJnbiI6InVzZTEifQ.-2Lit4s46ZF6AXuMW9t0TxIaFLkHqD4Yo-PyM9i2XZY" monday = MondayClient(monday_key) @@ -203,5 +205,17 @@ combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left") import datetime timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M') +# Upload to sharepoint attribute = ['address', 'client', 'job_type', 'rate'] -combined_with_rates[attribute].to_excel(f'NCHA Almshouses_{timestamp}.xlsx', index=False) +master_folder_name = "NCHA Almshouses" +file_name = f"{master_folder_name}_{timestamp}.xlsx" +combined_with_rates[attribute].to_excel(file_name, index=False) + +file_path = os.path.abspath(file_name) + +upload_to_month_end_folder(file_name, file_path, master_folder_name) + +invoice_name = "rate_card.xlsx" +file_path = os.path.abspath(invoice_name) +rate_card_df.to_excel(invoice_name, index=False) +upload_to_month_end_folder(invoice_name, file_path, master_folder_name)