Chapter 3: Connecting Google Account and Clasp

* If you need help with the content of this article for work or development, individual support is available.

What you will be able to do in this chapter:

  • Turn on Google Apps Script API
  • Connect Clasp and Google account (Authentication)
  • Time required: 5-10 minutes
  • Stumbling block: Surprised by warning screen (It's normal!)

Finally, we will make it possible to give instructions from your computer to the "digital subordinate (GAS)" who works for you 24 hours a day. It is a "greeting" ritual called clasp login. Some technical screens will appear, but if you proceed according to this article, it will be fine. Once you get over this, the world of automation is right in front of you!

1. Why is "Greeting (Login)" necessary?

Last time, we installed "interpreter tool for GAS" called Clasp on your computer. However, as it is now, Clasp cannot see your Google Drive or Spreadsheet without permission. Naturally. Even if it is a subordinate, it is a big problem if they open the president's desk drawer without permission.

Therefore, a ritual of "Greeting (Login Authentication)" is necessary to tell Google "Instructions from this computer are instructions from me (you)".

This only needs to be done once. Now, let's get it done quickly!

2. Step 1: Unlock the "Dedicated Door" for subordinates

First, on your Google account side, unlock the "Dedicated Door (API)" to accept instructions from external tools like Clasp. Usually it is closed for security, so imagine opening it.

  1. Access Google Apps Script Settings Page in your browser.
    • If you are not logged in to Google, please log in with the account you want to use for automation (personal Gmail account, etc.).
  2. Find the item "Google Apps Script API".
  3. Click the switch to turn it "On" (blue).

That's it! It's like opening the door of the president's office and permitting "You may enter". If you forget this, the subordinate will say "President, the door won't open!" (User has not enabled the Google Apps Script API) later.

3. Step 2: Shake hands firmly with the interpreter tool (Clasp)

Finally, connect your computer and Google account. Return to the terminal (black screen), type the following "greeting command", and press Enter.

clasp login

Then, the browser opens automatically and the Google login screen appears.

Just follow the instructions on the screen!

  1. Select Account: Select the Google account for which you unlocked the "Dedicated Door" earlier.
  2. Request Access: A screen "Clasp wants access to your Google Account" appears. This is the same as a subordinate asking for permission "May I write invoice data in the spreadsheet?".
    • Click "Allow" here.

⚠️ What if a warning screen "This app hasn't been verified by Google" appears?

This might be the most startling screen when using it for business. Please rest assured. This is normal behavior.

This is just the Google security guard confirming just in case, "The tool called Clasp is a specialized tool used by developers, not an app for general consumers sold in the AppStore. Can you really trust it?". Since Clasp is an official tool made by Google itself, reliability is outstanding. As the president, you should permit it saying "It's okay, it's my subordinate".

  1. Click the link "Advanced" (or "Details") at the bottom left.
  2. Click "Go to (unsafe page)".
  3. Press "Allow" on the subsequent screen.

Sign of successful greeting

If the following English is displayed in the browser, the greeting is successful!

Logged in! You may close this page.

Close the browser and return to the terminal.

Example of success:

Saved the credentials to C:\Users\User\.clasprc.json

If this message appears, it is proof that a pipe of trust has been connected between your computer and Google account.

  • "Credentials" means "duplicate key". A duplicate key to Google has been saved in a safe place on your PC.

4. Frequently Asked Questions (Q&A)

Q1. Which is better, company account or personal account?

A. Let's practice with "personal Gmail account" first. In the case of a company Google account (Google Workspace), "access from external tools" may be prohibited by the administrator's settings. It is smoother to consult the IT department of the company after getting used to it with a personal account first.

Q2. I use multiple Google accounts…

A. Do it while logged in to "only the account you want to use" in the browser. If you are logged in to multiple accounts, you may be authenticated with an unintended account. The most certain way is to open the URL in "Incognito Window" or log out from all accounts once.

Q2. When I want to switch accounts?

A. Log out once and log in again.

clasp logout  # Dissolve relationship with current subordinate
clasp login   # Greet new subordinate

Q3. Do I need to do "Login" every time?

A. No, once is OK. Even if you restart the computer, the login state is maintained.

5. Understanding Check Quiz

Q1. What setting needs to be turned "On" in the browser before using Clasp? A. Google Maps API B. Google Apps Script API C. YouTube API

Q2. What happens when you type clasp login command? A. Computer restarts B. Browser opens and Google login screen appears C. Phone call comes from Google

Q3. What to do if "This app hasn't been verified" appears? A. Close browser because it's scary B. Proceed with "Advanced" -> "Go to unsafe page" -> "Allow" C. Turn off computer power

Answer Check (Click to open)

Q1: B Clasp will not work unless "Google Apps Script API" is turned on.

Q2: B Authenticate in the browser.

Q3: B This is a warning specific to developer tools. Clasp is safe as it is an official tool.


Now you are ready to give instructions to your "digital subordinate" anytime. This was the biggest wall of technical terms. Thank you for your hard work!

From the next chapter, we will finally enter specific project creation to create "Invoice Creation Robot" and "Sales Report Auto-generation Boy". Exciting!


What to do in the next chapter:

  • Create a new project with clasp create
  • Open browser with clasp open
  • Open project in VS Code

>> Next Chapter: Chapter 4 Creating your first GAS project

Series Index

ZIDOOKA!

Need help with the content of this article?

I provide individual technical support related to the issues described in this article, as a freelance developer. If the problem is blocking your work or internal tasks, feel free to reach out.

Support starts from $30 USD (Estimate provided in advance)
Thank you for reading

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Policy on AI Usage

Some articles on this site are written with the assistance of AI. However, we do not rely entirely on AI for writing; it is used strictly as a support tool.