r/GoogleAppsScript • • Jan 26 '22

Question Noob looking for guidance

Hi all,

I am a beginner in Appscript and I'm trying to build a Google Sheet -> Data Studio dashboard using data from external APIs. Can someone link me some informative YouTube videos on how to make the initial connection between Appscript and 3rd party API? Specifically all the oAuth stuff & where to exchange keys on both sides. Would be super helpful and I would appreciate it greatly!

Thank you!!

8 Upvotes

6 comments sorted by

3

u/elcriticalTaco Jan 27 '22

I would recommend some very strong alcohol and an extra large bottle of tylenol.

Google is...frustrating to say the least when it comes to fleshing out the actual steps you need.

If you can list the external APIs you are wanting to use someone may have already done the legwork for you. Github often has code ready to go for different APIs, I found one for quickbooks that was a lifesaver (well liver saver).

If you do find a decent all around guide that produces results, please link it here. You are far from the only one with this question.

Godspeed my friend.

2

u/Freedom-35-Boys Jan 27 '22

Thank you! So here’s my noob question again. How does this all work? Google AppScript is the platform and uses web url command to communicate with APIs but you have to specify your access token within your code or within each request.

To get a code from some services, you have to send a POST request with the correct headers/body and it returns your api access Auth code? Does this sound right?

I’m just trying to learn as much as I can but so far nothing on YouTube has been helpful lol

1

u/elcriticalTaco Jan 28 '22

https://www.youtube.com/watch?v=RRQvySxaCW0&list=PLv9Pf9aNgemt82hBENyneRyHnD-zORB3l&index=1

This video series isn't specifically about APIs, however it was really helpful to me in developing knowledge of using POST/GET in sheets.

With APIs, all of them are slightly different. The best way to get help would be to list the specific APIs you want to use, as then we can tailor the answer for you. There isn't really a "global" tutorial on how to use APIs with apps script.

I am by no means a pro, but the best advice I would like to give my noob self is to not be afraid to use other peoples code. When I started I wanted to do everything from scratch and understand precisely how everything worked. It just made it harder. Most people who get paid to write code just copy from stackoverflow or github. I do. The 17 people reading this do. You should to.

When you learn to ride a bike you don't have to know how to build one first. You learn how to pedal and balance by using someone elses work.

3

u/davchana Jan 27 '22

For Google script side look at URL fetch reference google apps script, with parameters & headers.

For api side look at thier html or ajax or http api & required structure.

1

u/tbroas Jan 27 '22

I used a combination of the tutorials below, they aren't new but they showed enough to push me in the right direction with what I was doing (3rd party API > Google Sheets > Data Studio).

However, I am just using Basic Authentication though for my project and not oAuth, so my case is likely much more simple, so this may or may not help:

1

u/t-janczuk Feb 07 '22

One way to easily connect to APIs that require OAuth authentication to import data into your Google Sheets is to use the Fusebit Add-On for Google Sheets. It allows you to use Node.js, any npm module, and Fusebit Connectors to call into third-party APIs after you initially authorize access via OAuth. I don't know what system you want to connect to, but you can get an idea of the end-to-end experience for getting data from Salesforce to Google Sheets or importing and updating data in Linear from Google Sheets.

Disclosure: I am the co-founder of Fusebit. The Fusebit Add-On for Google Sheets is a free tool we provide to Google Sheets users and developers to help them integrate Sheets with any API or service using Node.js and npm.