Puente Power Automate, servidor local del tablero HTML v7 y exportacion a Excel/TSV para monitoreo de proyectos en Microsoft Planner. Co-authored-by: Cursor <cursoragent@cursor.com>
79 lines
2.1 KiB
Markdown
79 lines
2.1 KiB
Markdown
# Sincronizar Planner con Tablero HTML v7
|
|
|
|
El archivo `Tablero_proyectos_v7.html` **no se modifica**. Lee datos desde una Google Sheet publicada como TSV.
|
|
|
|
## Flujo
|
|
|
|
```powershell
|
|
python script.py
|
|
python sync_dashboard.py
|
|
```
|
|
|
|
Abre el HTML en el navegador: mostrará los datos de Planner.
|
|
|
|
## Modo manual (sin Google API)
|
|
|
|
Si aún no tienes cuenta de servicio:
|
|
|
|
```powershell
|
|
python sync_dashboard.py --tsv-only
|
|
```
|
|
|
|
Esto genera `output/dashboard_rtc.tsv`. Importa ese archivo a la Google Sheet que publica el HTML (Archivo → Importar → Reemplazar hoja actual).
|
|
|
|
## Configuración automática (Google Sheets API)
|
|
|
|
### 1. Obtener el ID de la hoja
|
|
|
|
Abre la Google Sheet en el navegador. La URL tiene este formato:
|
|
|
|
```
|
|
https://docs.google.com/spreadsheets/d/1AbCdEfGhIjKlMnOpQrStUvWxYz/edit
|
|
```
|
|
|
|
Copia el ID (`1AbCdEfGhIjKlMnOpQrStUvWxYz`) a `.env`:
|
|
|
|
```
|
|
GOOGLE_SPREADSHEET_ID=1AbCdEfGhIjKlMnOpQrStUvWxYz
|
|
GOOGLE_SHEET_NAME=Hoja 1
|
|
```
|
|
|
|
> **Nota:** El ID de publicación (`/d/e/2PACX-...`) del HTML es distinto. Para escribir datos necesitas el ID de edición.
|
|
|
|
### 2. Cuenta de servicio
|
|
|
|
1. En [Google Cloud Console](https://console.cloud.google.com/), crea un proyecto.
|
|
2. Habilita **Google Sheets API**.
|
|
3. Crea una **cuenta de servicio** y descarga el JSON.
|
|
4. Guarda el archivo en `credentials/google_service_account.json`.
|
|
5. Comparte la Google Sheet con el email de la cuenta de servicio (rol: **Editor**).
|
|
|
|
### 3. Variables en `.env`
|
|
|
|
```
|
|
GOOGLE_SPREADSHEET_ID=tu_id_de_hoja
|
|
GOOGLE_SHEET_NAME=Hoja 1
|
|
GOOGLE_CREDENTIALS_PATH=credentials/google_service_account.json
|
|
```
|
|
|
|
### 4. Sincronizar
|
|
|
|
```powershell
|
|
pip install -r requirements.txt
|
|
python sync_dashboard.py
|
|
```
|
|
|
|
## Mapeo Planner → columnas del HTML
|
|
|
|
| Columna HTML | Origen Planner |
|
|
|--------------|----------------|
|
|
| id | `plan_id` |
|
|
| nombre | `proyecto` |
|
|
| estadoGlobal | `Completado` o `En curso` |
|
|
| progreso | `porcentaje_avance` |
|
|
| fechaObjetivo | Última `fecha_vencimiento` del plan |
|
|
| comentarioRetraso | `Ninguno` o `X tareas vencidas` |
|
|
| tarea | `tarea` |
|
|
| responsable | `asignados` |
|
|
| fechaFin | `fecha_vencimiento` (YYYY-MM-DD) |
|
|
| estado | `porcentaje` como `50%` o `100%` |
|