Jump to content
  • Sign Up

Google sheet with official gw2 API


Zathuw.4209

Recommended Posts

Hey hi, is there any reason that i cant use the gw2 api on google sheet?

I have to use others websites api (gw2spidy or gw2tp etc) but recently i wanted to access my tp history on google sheet but only the gw2 api is giving me this information, i know my code is right since its working with others API but i feel like the official gw2 api is blocked on google sheet, anyone knows anything about it?

 

Thx!

 

edit: i have no error codes, just blank cells.

Edited by Zathuw.4209
Link to comment
Share on other sites

Quote
function apiFetch(keyurl){
   var data;
    if(key){
      var opt = {
        'headers': {
          'Authorization''Bearer ' + key,
          'muteHttpExceptions'true
        }
      };
    data = UrlFetchApp.fetch('https://api.guildwars2.com/v2/' + urlopt);
    data = data.getContentText();   
  }  
  return JSON.parse(data);
}

 

Try this in apps script

 

key needs to be your bearer token

url needs to be the api-path you want to call. E.g.: 'account/wallet'

 

this will return a json-object, but gs or basically js can deal very well with it

 

deleted some lines which are not interested for you and didnt validated the syntax, so maybe there is some missing semicolon or bracket

 

cheers

Edited by blackicedragon.3579
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...