Closed Thread
Results 1 to 8 of 8

Pull Vehicle data from DVLA to Excel. Possibe?

  1. #1
    Registered User
    Join Date
    09-08-2021
    Location
    UK
    MS-Off Ver
    2019
    Posts
    6

    Question Pull Vehicle data from DVLA to Excel. Possibe?

    Hi all,

    First off, I'm not even sure if this is possible, but I'm sure you guys can tell me either way.

    I'm want to be able to input a vehicle registration in a cell, and have a cell called 'Year' pull the date of manufacture from the DVLA API. I have an Api key.

    The DVLA API website says:

    To call the API, make a HTTP POST request to the following URL:

    *API address but I'm not allowed to post it.*

    and include the following in the request body:

    { "registrationNumber": "TE57VRN" }

    You must also include a mandatory x-api-key header with each request you send. This must contain the API key which you have been issued with.

    -------

    There is an example but nothing that is applicable to Excel, hence why I'm not sure if it can even be done.

    Again, very much appreciate any help that

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Pull Vehicle data from DVLA to Excel. Possibe?

    Yes it's possible. I've done some similar stuff recently to retrieve information from the Jira API. You're going to need to:

    1. Get hold of a JSON converter for VBA. Personally, I used this one: https://github.com/VBA-tools/VBA-JSO...nConverter.bas
    2. Import that module into your VBA project
    3. Add a reference to Microsoft XML, v6.0 in your code project
    4. Do something like this:

    Please Login or Register  to view this content.
    Obviously I can't validate all of this without having an API key myself but hopefully this gets you moving in the right direction.

    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Pull Vehicle data from DVLA to Excel. Possibe?

    Can confirm the above works as expected (I do have an API key), you probably want to change this:
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Though

  4. #4
    Registered User
    Join Date
    09-08-2021
    Location
    UK
    MS-Off Ver
    2019
    Posts
    6

    Re: Pull Vehicle data from DVLA to Excel. Possibe?

    Hi guys,

    Thank you for this.

    I'm embarrassed because I'm still stuck. I imported the JSON converter and added the code, but when I run it, it's just blank. I put the code in the sheet VB, and I'm just pressing play macro to test, so maybe there's more to it than that.

    Also, is there a way to have the reg, "registrationNumber"": ""TE57VRN", change based on the value in a cell, or does it need to be manually written in new code all the time.

    Again, sorry for being a noob.

    Thanks again.

  5. #5
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Pull Vehicle data from DVLA to Excel. Possibe?

    OK. Let's suppose you put the registration in A1. Then try this:

    Please Login or Register  to view this content.
    That should put the year of manufacture in B1.

    WBD

  6. #6
    Registered User
    Join Date
    09-08-2021
    Location
    UK
    MS-Off Ver
    2019
    Posts
    6

    Re: Pull Vehicle data from DVLA to Excel. Possibe?

    Thank you again for this.

    EDIT: It's now working. Thanks so much. Just one other thing - is it possible to have it also do this for subsequent cells, i.e. A2, A3, A4 etc. I only need about 10 cells that check year of manufacture.

    Many thanks again for this.
    Last edited by ZedWings; 06-13-2022 at 06:48 PM.

  7. #7
    Registered User
    Join Date
    08-01-2023
    Location
    Wales UK
    MS-Off Ver
    365
    Posts
    14

    Re: Pull Vehicle data from DVLA to Excel. Possibe?

    Hi,

    I am trying to do the same thing. Ive followed all instructions but am getting a compile error in the JSON code :/

    Any ideas where Ive gone wrong please?
    Thanks

    Screenshot 2023-08-03 155410.png

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Pull Vehicle data from DVLA to Excel. Possibe?

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Movement of vehicle on on map in excel.
    By max2599 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2021, 02:00 PM
  2. Vehicle Time Table in Excel to Vehicle Movement Graph in Excel
    By Petrus in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2019, 04:54 AM
  3. [SOLVED] help with possibe index match or vlookup
    By Noah101 in forum Excel General
    Replies: 8
    Last Post: 04-19-2018, 07:48 AM
  4. Index vehicle, driver and vehicle wise revenue report.
    By dackson in forum Excel Formulas & Functions
    Replies: 41
    Last Post: 06-02-2017, 01:40 AM
  5. [SOLVED] Is it possibe to error trap Range.SpecialCells(xlCellTypeConstants) if found > 1?
    By kjy1989 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-04-2013, 07:34 PM
  6. Replies: 2
    Last Post: 01-30-2013, 12:06 PM
  7. Help! Is it Possibe to write UDF(custom formula) inside sheet
    By xcelion in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-14-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1