Please refrain from posting animated GIFs, memes, joke videos and so on in discussions other than those in the off topic area.

Dismiss this message to confirm your acceptance of this additional forum term of use.
You must be 16 or over to participate in the Brickset Forum. Please read the announcements and rules before you join.

Brickset API into Google Sheets - how to do it?

AlpinemapsAlpinemaps Member Posts: 4
I'm attempting to utilize the Brickset API into Google Sheets, but I'm having a bit of a problem.  Wanted to see if anyone had any advice.

What I'd like to do is pull the name of a set from the API and display it in my spreadsheet.  So, for instance, if I have '10030' in my Set # field (that I have input), then 'Imperial Star Destroyer' shows up in the API called field.

I'm using the IMPORTXML function within Google Sheets.  The function requires two parameters - the URL you are calling, and an XPATH query to run on the data.

So far, the only success I'm getting is when I use the correct URL, and then use the '*' parameter in the XPATH parameter. Unfortunately, that brings in all data in the call.  So, if I just run it on the checkKey operator, I only get the 'OK' value if I use '*'.  When I run it on the getSets operator, I only get values if I use '*' (the values are all of the data about the set I am calling).

The URL formatting isn't the issue (as far as I can tell), because I can successful use checkKey and getSets to at least pass the correct values and to call the info. The problem lays with parsing the data that comes back.  I'd really like to use getSets to just bring back the 'name' field.

When I try the same operation with more basic XML documents, it all works.  But for some reason, I'm not having any luck with Brickset.  Any suggestions?

Comments

Sign In or Register to comment.
Recent discussions Categories Privacy Policy