diff --git a/config.json b/config.json index 2d2a3d8..2308372 100644 --- a/config.json +++ b/config.json @@ -1,37 +1,47 @@ { "user_data": { - "first_name": "Denisa", - "last_name": "Cirsteas", - "company_name": "footprints", - "email": "test@test.ro", - "phone": "1231231231", - "store_name": "TEST9", - "country": "Romania", - "starting_date": "2026-01-01", - "duration": 36, + "first_name": "ggggfd", + "last_name": "fdgd", + "company_name": "hlhl", + "email": "kjhkjhk", + "phone": "hkjhkj", + "store_name": "asc", + "country": "hlkhkj", + "starting_date": "2025-10-01", + "duration": 24, "store_types": [ "Convenience", - "Supermarket" + "Minimarket" ], "open_days_per_month": 30, "convenience_store_type": { - "stores_number": 4000, - "monthly_transactions": 40404040, + "stores_number": 100, + "monthly_transactions": 101010, "has_digital_screens": true, - "screen_count": 2, + "screen_count": 3, "screen_percentage": 100, "has_in_store_radio": true, "radio_percentage": 100, "open_days_per_month": 30 }, - "supermarket_store_type": { - "stores_number": 200, - "monthly_transactions": 20202020, + "minimarket_store_type": { + "stores_number": 1000, + "monthly_transactions": 123123123, "has_digital_screens": true, - "screen_count": 4, - "screen_percentage": 100, + "screen_count": 2, + "screen_percentage": 1000, "has_in_store_radio": true, - "radio_percentage": 100, + "radio_percentage": 1000, + "open_days_per_month": 30 + }, + "supermarket_store_type": { + "stores_number": 0, + "monthly_transactions": 0, + "has_digital_screens": false, + "screen_count": 0, + "screen_percentage": 0, + "has_in_store_radio": false, + "radio_percentage": 0, "open_days_per_month": 30 }, "hypermarket_store_type": { @@ -45,19 +55,27 @@ "open_days_per_month": 30 }, "on_site_channels": [ - "Website" + "Website", + "Mobile App" ], - "website_visitors": 1001001, - "app_users": 0, + "website_visitors": 121212, + "app_users": 232323, "loyalty_users": 0, "off_site_channels": [ - "Email" + "Facebook Business", + "Google Business Profile" ], - "facebook_followers": 0, + "facebook_followers": 123123, "instagram_followers": 0, - "google_views": 0, - "email_subscribers": 100000, + "google_views": 123123, + "email_subscribers": 0, "sms_users": 0, - "whatsapp_contacts": 0 + "whatsapp_contacts": 0, + "potential_reach_in_store": 0, + "unique_impressions_in_store": 0, + "potential_reach_on_site": 0, + "unique_impressions_on_site": 0, + "potential_reach_off_site": 0, + "unique_impressions_off_site": 0 } } \ No newline at end of file diff --git a/index.js b/index.js index c25daf3..f08c8a2 100644 --- a/index.js +++ b/index.js @@ -45,7 +45,18 @@ async function updateConfig(formData) { radio_percentage: isStoreTypeSelected(formData, 'Convenience') ? parseInt(formData.convenience_radio_percentage) || 0 : 0, open_days_per_month: parseInt(formData.openDays) || 0 }, - + + minimarket_store_type: { + stores_number: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_stores) || 0 : 0, + monthly_transactions: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_transactions) || 0 : 0, + has_digital_screens: isStoreTypeSelected(formData, 'Minimarket') ? formData.minimarket_screens === "Yes" : false, + screen_count: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_screen_count) || 0 : 0, + screen_percentage: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_screen_percentage) || 0 : 0, + has_in_store_radio: isStoreTypeSelected(formData, 'Minimarket') ? formData.minimarket_radio === "Yes" : false, + radio_percentage: isStoreTypeSelected(formData, 'Minimarket') ? parseInt(formData.minimarket_radio_percentage) || 0 : 0, + open_days_per_month: parseInt(formData.openDays) || 0 + }, + supermarket_store_type: { stores_number: isStoreTypeSelected(formData, 'Supermarket') ? parseInt(formData.supermarket_stores) || 0 : 0, monthly_transactions: isStoreTypeSelected(formData, 'Supermarket') ? parseInt(formData.supermarket_transactions) || 0 : 0, diff --git a/test_copy.xlsx b/test_copy.xlsx index fe18319..8bfa851 100644 Binary files a/test_copy.xlsx and b/test_copy.xlsx differ diff --git a/update_excel_openpyxl.py b/update_excel_openpyxl.py index d162b75..16f7cee 100644 --- a/update_excel_openpyxl.py +++ b/update_excel_openpyxl.py @@ -120,6 +120,11 @@ def update_excel_variables(excel_path): except Exception as e: print(f"Error updating cell {cell_ref}: {e}") + # Force formula recalculation before saving + print("Forcing formula recalculation...") + wb.calculation.calcMode = 'auto' + wb.calculation.fullCalcOnLoad = True + # Save the workbook with variables updated print("Saving workbook with updated variables...") wb.save(excel_path) @@ -203,6 +208,11 @@ def update_excel_variables(excel_path): except Exception as e: print(f"Error extracting year from sheet name '{sheet_name}': {e}") + # Ensure formulas are marked for recalculation before final save + print("Ensuring formulas are marked for recalculation...") + wb.calculation.calcMode = 'auto' + wb.calculation.fullCalcOnLoad = True + # Save the workbook with updated variables and hidden sheets print("Saving workbook with all updates...") wb.save(excel_path) diff --git a/update_excel_xlsxwriter.py b/update_excel_xlsxwriter.py index 89d71bf..1852d7c 100644 --- a/update_excel_xlsxwriter.py +++ b/update_excel_xlsxwriter.py @@ -152,6 +152,11 @@ def update_excel_variables(excel_path): except Exception as e: print(f"Error updating cell {cell_ref}: {e}") + # Force formula recalculation before saving + print("Forcing formula recalculation...") + wb.calculation.calcMode = 'auto' + wb.calculation.fullCalcOnLoad = True + # Save the workbook with variables updated print("Saving workbook with updated variables...") wb.save(excel_path) @@ -398,6 +403,11 @@ def update_excel_variables(excel_path): except Exception as e: print(f"Error extracting year from sheet name '{sheet_name}': {e}") + # Ensure formulas are marked for recalculation before final save + print("Ensuring formulas are marked for recalculation...") + wb.calculation.calcMode = 'auto' + wb.calculation.fullCalcOnLoad = True + # Save the workbook with updated variables and hidden sheets print("Saving workbook with all updates...") wb.save(excel_path)