MyHoreca OLAP-to-GoogleSheets

{% if current_user.is_authenticated %}
Logged in as: {{ current_user.username }} | Logout
{% else %}
Login | Register
{% endif %} {% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %}
{{ message }}
{% endfor %} {% endif %} {% endwith %} {% if current_user.is_authenticated %}

RMS Server Configuration

Enter the details for your RMS server API. This information is used to connect, authenticate, and retrieve the list of available OLAP report presets.




{% if rms_config.get('password') %} Password is saved and will be used. Enter only if you need to change it.
{% else %} Enter the API password for your RMS server.
{% endif %}
{% if presets %}

Status: Successfully connected to RMS. Found {{ presets|length }} OLAP presets.

{% elif rms_config.get('host') %}

Status: RMS configuration saved. Presets not yet loaded or connection failed.

{% endif %}

Google Sheets Configuration

To allow the application to write to your Google Sheet, you need to provide credentials for a Google Service Account. This account will act on behalf of the application.

How to get credentials:
1. Go to Google Cloud Console.
2. Create a new project or select an existing one.
3. Enable the "Google Sheets API" and "Google Drive API" for the project.
4. Go to "Credentials", click "Create Credentials", choose "Service Account".
5. Give it a name, grant it necessary permissions (e.g., Editor role for simplicity, or more granular roles for Sheets/Drive).
6. Create a JSON key for the service account. Download this file.
7. Share your target Google Sheet with the service account's email address (found in the downloaded JSON file, key `client_email`).


{% if client_email %}

Current Service Account Email: {{ client_email }}

Upload a new file only if you need to change credentials.
{% else %} Upload the JSON file downloaded from Google Cloud Console.
{% endif %}

Enter the URL of the Google Sheet you want to use. The service account email (shown above after uploading credentials) must have edit access to this sheet.

{% if sheets %}

Status: Successfully connected to Google Sheet. Found {{ sheets|length }} worksheets.

{% elif google_config.get('sheet_url') %}

Status: Google Sheet URL saved. Worksheets not yet loaded or connection failed.

{% endif %}

Map Worksheets to OLAP Reports

Select which OLAP report from RMS should be rendered into each specific worksheet (tab) in your Google Sheet.

{% if sheets and presets %}
{% for sheet in sheets %} {% endfor %}
Worksheet (Google Sheets) OLAP-report (RMS)
{{ sheet.title }}
{% elif not sheets and not presets %}

Worksheets and OLAP presets are not loaded. Please configure RMS and Google Sheets first.

{% elif not sheets %}

Worksheets are not loaded. Check Google Sheets configuration.

{% elif not presets %}

OLAP presets are not loaded. Check RMS configuration.

{% endif %}

Render Reports

Select the date range and click "Render to sheet" for each mapping you wish to execute. The application will retrieve the OLAP data from RMS for the selected report and period, clear the corresponding worksheet in Google Sheets, and write the new data.

{% if mappings and mappings|length > 0 %}


{# Iterate through sheets loaded from Google, check for mapping #} {% for sheet in sheets %} {% set report_id = mappings.get(sheet.title) %} {% if report_id %} {# Only display rows with a valid mapping #} {# Find the preset name by ID using Jinja filters #} {# Find the preset dictionary where 'id' attribute equals report_id #} {% set matching_presets = presets | selectattr('id', 'equalto', report_id) | list %} {% set preset_name = 'ID: ' + report_id %} {# Default display if preset not found or unnamed #} {# If a matching preset was found, get its name #} {% if matching_presets %} {% set preset = matching_presets[0] %} {% set preset_name = preset.get('name', 'Unnamed Preset') %} {% endif %} {% endif %} {% endfor %}
Worksheet Mapped OLAP Report Action
{{ sheet.title }} {{ preset_name }}
{% else %}

No mappings configured yet.

Please go to the "Mapping Sheets to OLAP Reports" section (Step 3) to set up mappings.

{% endif %}
{% else %}

Please, login or register

{% endif %}