Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

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

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
googleintegrationquickstartspreadsheets
2 Réponses
8649 Vues
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
Ignorer
Avatar
Clément Stampe (clst)
Auteur Meilleure réponse


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
Ignorer
Avatar
TIZ
Meilleure réponse

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
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Google Spreadsheets Résolu
google spreadsheets
Avatar
Avatar
1
mars 15
10676
How to link Odoo to Google spreadsheet? Résolu
google quickstart spreadsheet
Avatar
Avatar
2
déc. 24
18212
Odoo Google spreadsheet error Résolu
google oauth spreadsheets
Avatar
1
janv. 23
3640
Can anyone provide a detailed explanation of how to use the Google Spreadsheets module?
google v11 spreadsheets
Avatar
Avatar
Avatar
Avatar
3
mai 22
15636
Odoo Spreadsheet category_id
google spreadsheets spreadsheet
Avatar
0
juil. 21
2925
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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