Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y asistencia informática
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

How to automatically update data in Google Spreadsheet with an Odoo integration

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
googleintegrationquickstartspreadsheets
2 Respuestas
8647 Vistas
Avatar
Clément Stampe (clst)

The purpose of this forum entry is to explain how it is possible to update automatically the data linked to an Odoo database in Google Spreadsheet. The goal of this action is to continually share updated data thanks to a Google Spreadsheet integration.

-1
Avatar
Descartar
Avatar
Clément Stampe (clst)
Autor Mejor respuesta


1. The first step is to make the connection between Odoo and Google Spreadsheets working. Since it is not the subject of this forum entry, I assume the connection is done and the extraction of data in Google Spreadsheet works. 

 Since we have a formula for extracting data from the Odoo database, we now want to have updated data each time we open the spreadsheet or depending on a time-driven solution. 

The easiest way to do so is to refresh the formula extracting the data (so basically the “oe_browse”   or “oe_read_group”). One way to do it manually is to cut the formula and paste it in another cell or we can also insert a line above the formula. Both ways work but since we have to do it manually it is not efficient and totally not user friendly. 


2. The second step consists of implementing a solution to refresh the formula automatically. One way to do so is to change data in the formula. Indeed, if you go into your formula and modify the number of lines displayed for example (the last line of your formula) you will see that the formula is refreshing. So we know that by modifying a condition in the formula, the formula is refreshed and the extracted data is updated. 


So what we could do is to say in the formula that the lines displayed in the Spreadsheet must be the number displayed in the cell E1. 

“=oe_browse("stock.quant";"product_id location_id owner_id available_quantity";"";"";E1)”


Now we want that the data, appearing in the cell E1, to fluctuate from one number to another. This way the formula will be updated each time the fluctuation occurs.  


3. In order to have this fluctuation, we will write, via the script (I will explain later why), in cell B1 the function =now(). This function will give the date and the hours in the cell. 

In cell C1, we will just write “=B1” to display the hour of the day. 

In cell D1, we will use the function “=minute” to display the minutes of cell C1. 

Thanks to these formulas, we will be able to have a fluctuation by adding in Cell E1 the following formula 

“=IFS(ISEVEN(D1) = TRUE;1000;ISEVEN(D1) = FALSE;1001)”

This formula will display the number “1000” for each even number and “1001” for each odd number. This way we will have a fluctuating number each minute and these numbers (1000 & 10001) will represent the number of lines displayed in our formula extracting the data.



4. What we need now is to automatically update the formula (=now) in order to make the formula in cell E1 move from one number to another.  In order to do so we will add in the script of the Spreadsheet the following function. 


“

function trigger_cell(){

   SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').getRange('B1').setValue(new Date()).setNumberFormat("MM/dd/yyyy");

}

“

A) Go to "Extensions"

B) Select "App script" 

C) Scroll down in the script, go on the last line and click on the "enter" button two times in order to have your cursor two lines after the last written line. 

D) Paste the function then save the script. 

E) Select the function to run (switch "_test" by "trigger cell") and Run the script. 

F) Once it is done and if you have no error message (you should not have an error message if you wrote nothing else in the script than the function), you should see in cell B1 the date of the day.


You do not need to understand how the function is written but you need to understand why we use the script to add the function “=now) in cell B1 instead of directly writing the formula in the cell. 


5. The reason is that we want to use the “Trigger option” available in Spreadsheet. A trigger is a way to refresh formulas depending on a condition (could be time driven or while opening the file for example). The thing is we can only use triggers on functions written in the script. This is why we created the function “now” instead of directly writing the formula “now” in the cell. 


So now we need to create a trigger. To do so, go back in the script (Apps Script), go on the left menu and click on the Timer logo. 

  1. Select “Triggers”, create a new one.

  2. Choose the function “Trigger cell” 

  3. Leave “Head” in “which runs at deployment”

  4. Select your event source, for example Time Driven 

  5. Select type of time based trigger, for example Minutes timer

  6. Select minute interval


6. Once everything is set, you will have your excel formula which extracts data from Odoo refreshed every minute thanks to the link with the cell E1. The cell D1 displaying the minutes will be refreshed every minute thanks to the link with the cell B1. The cell E1 will fluctuate from the number 1000 to 1001 each minute.


Here is the configuration without the explanation

B1: “now” function displayed via the script

C1: “=B1”

D1: “=minute(C1)

E1: “=IFS(ISEVEN(D1) = TRUE;1000;ISEVEN(D1) = FALSE;1001)”


The formula extracting data (just an example to show you the link): 

=oe_browse("stock.quant";"location_id product_id available_quantity";"";"";E1)


2
Avatar
Descartar
Avatar
TIZ
Mejor respuesta

Wow, Clément, that's a true game changer here! 

Thanks a lot!

Now that PowerBi or Powerquery include a functional Google Sheets Connector, that means that we're able to build complex dashboards that remain updated.


0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Google Spreadsheets Resuelto
google spreadsheets
Avatar
Avatar
1
mar 15
10676
How to link Odoo to Google spreadsheet? Resuelto
google quickstart spreadsheet
Avatar
Avatar
2
dic 24
18212
Odoo Google spreadsheet error Resuelto
google oauth spreadsheets
Avatar
1
ene 23
3640
Can anyone provide a detailed explanation of how to use the Google Spreadsheets module?
google v11 spreadsheets
Avatar
Avatar
Avatar
Avatar
3
may 22
15636
Odoo Spreadsheet category_id
google spreadsheets spreadsheet
Avatar
0
jul 21
2925
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now