Using Google Tasks API in Google Apps Script - Access not Configured - google-apps-script

I am getting 'Access not configured. Please use Google Developers Console to activate the API for your project' message.
I followed the guidance in the Google Developers Console documentation. I selected the 'Advanced Google Services' submenu under 'Resources' menu. I turned on the Google Tasks API and copied the API key from the Developers Console and pasted it into the 'Advanced Google Services' dialog and clicked OK.
I typed the example code from 'List task list' on the 'Tasks Service' page. The code autocompleted and saved fine. However when I ran the script I got the 'Access not configured' message. I went to the developers console and the Tasks API appears to be OFF. I do not seem to be able to turn it ON. Do I have to have an OAuth2 API key as well?
I apologise for having to ask for help as the documentation is good but I am confused as to what to do now.
Michael

Problem solved.
I re-read the documentation to do with enabling an API. I upgraded my script to use the new authorisation flow and then it created a new project ID in the developers console. I was able to turn on the Tasks API and the script is working.
Sorry for the trouble.
Michael

Related

Can't solve Google File Picker ScriptError on server

I was following this step-by-step about File Dialogs from Google developers Apps Script pages to insert a Google file picker dialog window into my add-on but I keep facing the same error:
ScriptError: Exception: We're sorry, a server error occurred. Please wait a bit and try again.
I have triple-checked all the steps, key, credentials, scopes in the manifest, and so on and the issue persists. I even looked into this video for some light. No need to say I waited "a bit" and tried countless times. What else might be causing this problem?
I had a similar issue with the file picker and also used the guide on the google homepage.
Try to call "DriveApp.getFileById(). If that results in the same error message, the method below should work.
There seems to be a bug within Google Apps script. You have to enable "Google Drive API" in your Google Cloud Platform Project. Then start the File Picker. Afterwards you may disable "Google Drive API" again.
For more information see StackOverflow, that's where I found the method.

The OAuth Error. Cannot solve TOS Violation

I get an error "The OAuth identity of this script has been deleted or disabled. This may be due to a Terms of Service violation" whenever I try to execute a script that gives me daily updates from my calendar into a spreadsheet.
I have searched for solutions and found this
Thread that suggests "The solution: - open the script - click Resources > Cloud Platform project - click on the bound project" and then I will be able to accept the new TOS.
When I look at my menus, "Resources" only gives me dropdowns for Libraries and Advanced Google Services. This is a script and isn't tied to a Cloud project.
What would you suggest I do to overcome this issue? (For reference, I believe the issue started appearing in April 2018).

No Such User when trying to access google apps script editor

In my Google spreadsheet, when I go to "Tools->Script Editor..", I get a page saying "No Such User" Error. Any idea how to fix this?
I figure this could be a permissions issue, but not sure how to change permissions if required.
Finally i found the solution accidentally.
The issue is resolved by enabling GoogleAppsScript as part of your drive.
Open Google Drive in your web browser.
Click New > More > + Connect more Apps
and then select GoogleAppsScript.
Once i did this going back to script editor of my spreadsheet, no more gives any error.
Here is the link which contained this step:-
https://developers.google.com/drive/v2/web/quickstart/apps-script
Also there is additional problem about Invalid OAuth Client when trying to run the script. which i faced since each apps script has to be attached to a Google Cloud Project. This is accessible only to the person who originally created the file even after its in the team drive. In which case, you need to make a copy of the apps script available by going into File->Make a copy. And then in the Resources drop down , you will see Cloud Platform Project, upon clicking it you can now give the project number of the Google Cloud Platform project you created on console.cloud.google.com.

Queries done in Sheets pulling from BigQuery (permissions help needed)

I want to set up scripts in sheets creating several menu options for predefined queries. This way normal bob can get his queries, Tina can get hers, and Fredrick in accounting can get the information he needs without out writing his own queries. They can use a fun menu:
screenshot
The data table is set up in BigQuery, and queries work fine using the 'compose query' option. The issue is getting queries written in the script to function in sheets. Here is a nice tutorial by Ido Green on how to go about it. https://greenido.wordpress.com/2013/12/16/big-query-and-google-spreadsheet-intergration/
My problem is getting the permissions to work. I believe I approved the project ID in BigQuery, but I am unsure of how to do this in Drive. This is new to me. Let me know if someone has the step by step. This is the error I get when I try to run the script:
"Exception: No suitable credentials found to access Google Drive. Contact the table owner for assistance."
Thank you for your help
Got the same issue with my Google Apps script.
Steps to fix
Enable Google Drive API in Resources -> Advanced Google Services
Enable Google Drive API in Google Developers Console for this project
Run 'DriveApp.getRootFolder();' to get Drive Auth Scope .
I think the problem is in the OAuth Scopes.
According to this SO question, If you are using the BigQuery web UI and have not explicitly granted access to Drive, it won't work. For example, the first time I tried to "Save to Google Sheets", the BigQuery UI popped up an OAuth prompt asking me to grant access to my Google Drive. After this it could save the results. Try doing this to make sure your credentials have the Drive scope and then "Save View" again.
If you are using your own code to do this, you should request scope 'https://www.googleapis.com/auth/drive' in addition to the 'https://www.googleapis.com/auth/bigquery' scope you are already using to talk to BigQuery.
Also check this SO question and this community page for more information.

Google Drive File Picker random sign-in error

Occasionally (sporadically) when the Google Drive file picker is triggered in our app by a properly authenticated user, the picker fails with a message that they need to sign-in to Google (note old Google logo) - clicking this message's Google sign-in button gives the error message API Developer key is invalid.
We removed the API Developer key from the picker call and now the error message after sign-in reads- Details:
The feature you requested is currently unavailable. Please try again later.
Usually the picker works after refreshing the page.
Is this a known bug for the Google Drive picker or is there a workaround?
Google Drive Picker Sign-in error
Google Drive Picker developer key error message
We ended up writing our own drive picker and not using Google's picker at all.
First make sure you use Browser key not Server key and try to verify if you follow the steps here in Register your Project. It will give you step by step procedure on how to use API key with your project. It also have code example for you to follow.
I also see this SO question related to your problem. Solutions here is to add .setCallback(pickerCallback) to createPicker function and add new function (pickerCallback). I hope it can help you.