How to Download your Jaguar InControl Trips to Google Sheets

Google Sheets: Jaguar InControl Trip Data Cover Image

When I learned that someone had Reversed Engineered the Jaguar InControl API, I thought it would be fun to see if I could connect Google Sheets to the API, and download the trips from my Jaguar I-Pace for my own analysis and visualization.

In this blog post I share my Google Sheets solution, and explain how you can download your own Jaguar InControl trips to Google Sheets automagically. Although I have only used Jaguar I-Pace data in the development of this solution, if you own a Jaguar fossil car with an Jaguar InControl Account, I think it should also work for you (although all the special calculations are mainly made for Jaguar EV).

Do also check out my 2 other related blog posts:

Updates

  • 26.02.2019:
    • Moved calculations from the Google Apps Script to a seperate Sheet.
    • Improved “removeDuplicates” from the Google Apps Script.
    • Added possibility to calculate a more correct Average Consumption.
  • 30.03.2020:
    • Added support for selecting the correct Jaguar if you have more than 1 car.
    • Improved effeciency of the script that is fetching trips. Script now uses less time in fetching trips and writing trips to Google Sheet.

Download your Jaguar InControl Trips to Google Sheets, a Step-by-Step Guide

There are unfortunately quite a few steps you have to go through to download your Jaguar InControl Trips to Google Sheets.

Google will throw some “red flags & warnings” at you in the process, since you will have to authorize the script that connects to the Jaguar InControl API. I don’t collect any of your data. I will see if  I can get those warnings fixed.

The reward you will get for going through all these steps, is that you will get 50+ columns of data about your Jaguar InControl Trips. Although this is much information, detailed information like all the waypoints for each trip will not be downloaded. That is a different part of the Jaguar InControl API. Maybe – one day – I will share a solution for this as well.

1. Open the Google  Sheets example, and make a Copy

Google Sheets - Make a Copy of the Jaguar InControl Trips Sheet

The Sheet contains 3 different Sheets:

  1. Jaguar InControl Trips API Data
    1. Data from the Jaguar InControl API is saved to this sheet. You can ignore this sheet and hide it if you like.
  2. Jaguar InControl Trips
    1. Here we do some calculations and add some more data, based on the data in the “Jaguar InControl Trips API Data” sheet. This is the sheet you should use for reporting and analysing your own trip data.
  3. Settings

2. Fill out the “Settings” Sheet

Google Sheets - Fill Out your Jaguar InControl Information

In the “Settings” Sheet, fill in “Username” & “Password” from your Jaguar InControl account.

The “Trip Count” field defines how many rows of data that should be downloaded from the Jaguar InControl API. Sometimes I get 3 months of data, sometimes I get more. The first time you run the “Jaguar InControl API” script, choose a “Trip Count” number high enough to download at least 3 months of data.

I explain under the headline “How to Download  your Trip Data on a Daily Basis (or more often)?”, how you can get more than 3 months of data (if only 3 months is returned).

In the “Overwrite Data” settings field, choose “Yes” the first time you run the scripts.

The Jaguar InControl API needs something called an X-Device ID. The script I have written will create a random X-Device ID if you leave this field empty. If this for some reason doesn’t work, try a value from the Online UUID Generator.

3. Running the Jaguar InControl Script for the First Time

Google Sheets: Select Menu Tools -> Script-editor

  • From the Menu, choose “Tools -> Script editor”.
    • You will now be revealed to the Google Apps Script that I have written. Don’t worry, you don’t have to do any coding. 🙂

Google App Scripts: Run the Jaguar InControl Script for the first time

  • Make sure that “AuthJaguarInControlApi” where the Red Arrow is pointing is selected.
  • Click on the “Play Button” where the Green Arrow is pointing.

Go through the Authorization Process

As mentioned, Google will throw some “red flags and warnings” at you in the authorization process the first time.

Google App Scripts: Authorization RequiredGoogle App Scripts Authorization: Choose Account
1. Google App Scripts: Authorization Required - Review Permissions2. Google App Scripts Authorization: Choose Account
Google App Script: This App Isnt VerifiedGoogle App Scripts Authorization: Go To Jaguar InControl API (unsafe)
3. Google App Script: This App Isnt Verified Warning. Click on the "Advanced" link.4. Google App Scripts Authorization (unsafe) warning. Click on the "Go To Jaguar InControl API (unsafe)" link
Google App Scripts Authorization: Allow Access
5. "Allow" Jaguar InControl API to access your Google Account.

You can at any time remove access to this solution in your Google Account if you regret that you gave the authorization.

If you made it so far, the Google Apps Script which I have called “Jaguar InControl API” will now run, and download your trips to the “Jaguar InControl Trips” Sheet. If not, click the “Play Button” again.

The script will also update some information about your Jaguar InControl Account in the “Settings” Sheet.

4. How to Download  your Trip Data on a Daily Basis (or more often)?

As mentioned, you will maybe only get 3 months of trip data from the API. However, we are not limited to only 3 months moving forward.

  • Go to the “Settings” Sheet again. Change the settings “Overwrite Data” to “No”.
    • From now on and moving forward, new trip data will be added to the existing data.
  • Change the “Trip Count” value to a number that it is hight enough to get at least trip data for 2-3 days. I have experimented with 20 as the Trip Count. You may need a higher number.
    • Why 2-3 days? If you run the script once a day, it may fail 1 day, but then the data will still be captured the second or third day.

Create 2 Google Apps Script Triggers

Google App Scripts: Project Triggers Menu - Edit -> Current project's triggers

  • Go to the Google Apps Script again (“Tools -> Script editor”).
  • From the Menu, choose “Edit -> Current project’s triggers”

Google App Scripts: Add Project Trigger

  • Click on “Add Trigger”
    • We are going to add 2 Triggers as shown below.
Google App Scripts: AuthJaguarInControlAPI-TriggerGoogle App Scripts: RemoveDuplicates Trigger
This Trigger Adds Trip Data to the Sheet.This Trigger Removes Duplicate Trip Data from the Sheet.
  • The first Trigger will Add Trips to the Sheet. How often you should run the trigger is up to you. I run the trigger every night.
  • The second Trigger will Remove Duplicate Trips from the Sheet.
    • When Trips are added to the Sheet, duplicate Trips will be added. This Trigger starts a function that Remove Duplicates.
    • This Trigger should be started after the first trigger have finished. As you can see from my setup, I run the first Trigger between 3 & 4 in the night, and the second trigger between 4 & 5 in the morning.
    • If you want a more frequent update, a rule of thumb is that a Google Apps Script will run for maxium 6 minutes, so your second trigger must start at least 6 minutes after the the first trigger.

If you have made it so far, congratulations! Your Jaguar InControl Trips will now automagically be downloaded to Google Sheets.

Some Closing Words

No cats where harmed in the development. I do however admit that the Jaguar InControl API did miaows to me several times with error messages before I got the Google Apps Script working.

This solution is built upon an Unofficial Jaguar InControl API, so I don’t guarantee for the future. I do not know who did the job creating the API. If you know, please let me know so I can give credit to the(se) person(s). Paw Whack to you!

This solution is in no way a product of Jaguar or related to Jaguar. I’m just a happy Jaguar I-Pace owner that happens to work with data, and thought it was great fun to write the Google Apps Script and create the Google Sheet.

Happy driving and analyzing your Jaguar car!

9 Comments on "How to Download your Jaguar InControl Trips to Google Sheets"

  1. Sahil Gandhi | April 2, 2019 at 5:26 pm | Reply

    Hi,

    I have a question… I was trying to find the endpoint for starting and stopping the vehicle.
    Do you happen to know about that??

    Sahil

    • Eivind Savio | April 2, 2019 at 9:18 pm | Reply

      Hi Sahil

      Can you elaborate what you mean with “find the endpoint for starting and stopping the vehicle.”?

      In the Sheet you have Start Address, Start Coordinates, End Address, End Coordinates etc. Not sure I understand what you are looking for.

      Regards,
      Eivind

  2. Very impressive work – Thank you for sharing

    As I am writing this what seem to be all my trips are downloading, passing 6 months right now!

  3. Hi Eivind

    This looks just what I want. However, it doesn’t bring back my I-PACE details, instead it brings back data on a Discovery Sport I had at the start of the year. I’ve checked, and I’m using the correct login details for the I-PACE (they work on the InControl website).

    Are there settings in the second box I can change to bring back the correct vehicle?

    Spencer

  4. Hi

    Scrap my previous question – all sorted.

    What I would like to know though is if there is a way to bring back % of battery used (or start and end battery %s) via the API – is there another variable that does that, that I could add in?

    Thanks

    • Glad you got it sorted. The code doesn’t really handle several cars, so I guess that was your problem.

      Regarding % of battery used, that information is available in a different part of the API (which I doesn’t query in my code).

      I’ll make a note of that, if I find the time to improve the solution.

      Regards,
      Eivind

  5. Hi
    Thanks for your response.
    If you happen to know the variable that brings the % battery used, I can add it into my copy of the code easily enough – just let me know.
    Thanks
    Spencer

  6. Leandro Corceiro | January 3, 2023 at 12:32 pm | Reply

    Hi. Thanks a lot for your work! Amaizing!
    Do you know how to force the InControl Server to contact the car to update the info?
    I made a sheet just to get the State of Charge, but it only gives me the value when I had stopped the car.
    I was trying to force an update like the oficial App does, but can’ t find how.
    I already read the Postman Api info and have it on Postman. I already implemented the vhs token authentication and POST the “get vehicle health status” that suposely would update the status info… but it didnt’ t (not on Postman or in the Google App Script).
    Do you know how to do it (update the server info by forcing a car query)?

Leave a comment

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.