Restricted access issue: unable to run a code workbook script to produce a dataset - palantir-foundry

After previously being able to run code workbook scripts, the run button has now been 'greyed out' with a permissions restriction message saying 'No permission to run in output folder' when I hover over the button.
Does anyone know why this has occurred and how to recover permissions to run?

The error indicates that the output dataset that this step in the workbook produces has been moved to a different location (probably a different project) where you don't have write access.
Try viewing the dataset in Compass (the file browser). This might tell you who has most recently edited it, which could help you find the right person to ask why it was moved. You might not be able to do this if you don't still have discoverer access on the output dataset.
Alternatively, ask your permission administrator or IT team for access to the project it has been moved to / for it to be moved back.

Related

Simple function suddenly throws "An unknown error has occurred, please try again later"

Since today morning, I am getting the below message while trying to run new App scripts on a new Google sheet.
Error An unknown error has occurred, please try again later.
My other App scripts attached to existing Google sheets continue to run fine. But if I create a new sheet and add even a plain simple function as shown below and try to execute this, I get the above error after it attempts to run it for some time and then gives up.
function Mytest()
{
}
I suspect that it is not able to bring the permission box which it use to bring up for any new script created. Till yesterday, once the permissions dialog box comes up and I used to give the permissions, the scripts use to run fine. But today it is not even bringing up the permission dialog box.
It looks like there is a outage going on with Google Apps Script when running new projects. I can see a couple of people reporting it in Google's public issue tracker.
It looks like it is only affecting new projects but most old projects are running fine. In the meantime you can add more info to the report to bring more attention to it. I have made some tests in 4 different accounts from different organizations and I can confirm I am also affected by this.
A couple users are reporting that it started to fix itself, and it looks like clearing cache and cookies from the browser may solve the issue (this is not a definitive solution but may work for you).
Only happens with Apps Script-managed Google Cloud Platform projects. Seems okay if you manually set the GCP project with the id using Resources > Cloud Platform Project...
I tried this because mine started with this error:
We're sorry, there was an unexpected error while creating the Cloud Platform project. Error code DEADLINE_EXCEEDED
I was having the same issue. Adding the script ID to the Library seemed to fix it.
Go to the "settings" option in the left menu of the script editor and copy the script id. Then click the plus icon next to the "Library" option and click "look up". Once the script is found, click "add" and run the script.

Permission to run a script created by another user

I am having a problem running a script that is set up by one person but I need to also be able to run and debug the script.
I am new to using Google Sheets scripting and do not understand the correct steps need to do to run a script setup by one person at a different location and I need to debug and run the same script on the same worksheet.
I have been given access to the worksheet and can edit the Google Sheet and edit the script but when I try to run the script using the interface run option or run the script on by using a button or the worksheet. It works fine in the original location, but does not work for me.
I am forced to give start to permission process but told that I need to contact the person that original created the worksheet it gives me his email address.

Permission denied when trying to create a spreadsheet using Google script API

In the corporate environment with a corporate account I have a Google Document. Think of it as a master document that is being maintained.
I want to add a script to it to create a derived spreadsheet that can be used by people who need a subset of data from the master document.
In the master document I created a script file so the script is bound to the document.
Inside the file I defined a function. Function does some search and processing in the master file without problems but once I try to create or open an existing spreadsheet to extract data from the master document to a derived document the call fails.
I tried several approaches:
SpreadsheetApp.openByUrl();
SpreadsheetApp.create("My test sheet");
and approach covered in the solution
I also tried execution from an installed menu trigger or from debugger - same result.
In all cases I get a pop up with :
Authorization required
{doc name} needs your permission to access your data on Google.
with two buttons to review and cancel.
Clicking review leads to a message "An unexpected error occurred" at the top of the screen.
I tried different machines and browsers and switched V8 engine on and off.
I also made sure that the document is open to all in my org if I try to open an existing doc by URL.
What am I doing wrong?
It turned out that there were two things.
Adding scopes solved the problem.
I had an invalid scope that
was already there (I do not know how it got there, probably from an
example) that I preserved in the manifest and might have misspelled.
That was a mistake. It caused all sorts of instability. Only when I
tried to execute the script in FireFox instead of Chrome was I able
to see a popup that gave me a hint that one of the scopes is invalid
and I need to fix it.
Once I fixed it, everything started to load as expected.

How can my Google Apps Script be run by others the Sheet is shared with?

I've got a Google Apps Script that works fine for me. Others who the sheet is shared with that try to use it get the message:
You do not have access to perform that action. Please ask the owner of
this item to grant access to you.
The script is used to update an existing sheet with new rows of data. It's triggered using a menu item added to the UI and does the following:
Finds a .xlsx file in a GDrive folder (this file is exported by a web service and manually placed by us into the GDrive Folder, we have no control over the contents of the file or its format)
Converts the file from .xlsx to .gsheet using UrlFetchApp (uploadType=media&convert=true)
Changes the filename and folder location of the resulting .gsheet using UrlFetchApp. The folder location now matches that of the .xlsx file (when a file is converted using UrlFetchApp the resulting file seems to be placed in the root of GDrive)
Gets the .gsheet using DriveApp and then opens it for access by the script
Stores all the data from the .gsheet into a 2d array using column headers as the keys for each element in a row
Stores all the ID values (unique) of the existing data from the destination sheet into a 1d array
Compares the two arrays and removes any rows from the 2d array that contain an ID that matches one in the 1d array, leaving only new data in the 2d array
Loops through each row of the 2d array and then through each column of the destination sheet adding data from the 2d array row to a new row at the bottom of the data in the destination sheet, using the value of the column header as the key for each element
I know there's no problem with the code because it works fine for me so it must be a problem with permissions, but I can't figure out how. The sheet is shared with them and the GDrive folder that the files are stored in is shared with them. When I first ran the script myself, I had to grant permissions for the script to access the GDrive folder, which has obviously now been done.
I'm the developer of our group and not the user of the data but atm I'm having to run the script to update the data for the users every time it needs doing instead of them just doing it themselves, which is... annoying.
Any help in trying to figure out where the problem is here greatly appreciated.
EDIT: Reading through this again its occurred to me that when the file is converted, at first its saved to the GDrive root which is why I then have to change the folder. Being the root, it's not shared with the users of this file. Could this be the reason? If so, how can I get around this? Can I specify at convert time which folder the resulting file should be saved to?
To fix this, you need to deploy the script as a web app (the idea comes from #MarioR answer, but the settings are different):
With the owner account, open the sheet, then script editor
Click on Publish and then Deploy as web app
For Execute the app as, choose User accessing the web app and for Who has access to the app, choose Anyone
The first time the users try to use the script, they will have to allow the script (if they get a This app isn't verified, they should click on Advanced at the bottom and then Go to <script name> (unsafe)). After this, they may need to refresh the sheet to be able to run the script.
If the owner shares the sheet to a new user, after the script has been deploy as a web app, the new user may need to wait 15 minutes (or so) before being allowed to authorize the script (meanwhile this user will continue to get the red warning).
Only the owner can deploy as a web app, the other users who try do to it won't get a message error, just a popup Fetching Data that remains stuck forever!)
To change the owner: open the sheet with the owner account, click on Share > Advanced > Click on the arrow that triggers the dropdown next to the "owner-to-be" > Set as owner
In my experience, I created a Spreadsheet that retrieves G Suite License information for users every time the Spreadsheet is opened. What I did was that I created the script with a Super Admin but when the Spreadsheet was shared the other users had the same problem until I went to Publish > Deploy as Webb App from the Apps Script menu, I leave the options like this image
That worked for me, I hope it works for you. After this update, all users with Edit rights on the spreadsheet were able to retrieve the information on behalf of the Super Admin every time the spreadsheet opens. Just make sure to execute the App as you and not as the user who will use the script or spreadsheet.
Usually other users are not able to run scripts that required admin rights but this resolves my issue. Please let me know if this worked for you!
Greetings.
I've got "doGet" after trying out the script as a Web App. What does "doGet" mean?
I confirm #MagTun's and #browly's solution to share the file and wait for 15 minutes. I faced this problem last week even if I had given Edit permission to the file programatically. Tricky because some users get the screen to grant permission (correct) but some get either "You need permission" message or "Sorry, unable to open file at this time" (wrong). But I observed that after some time, the user is able to run the script with or without requesting access to the file explicitly. So there's really nothing else needed but wait for about 15 minutes and it prompts for permission consistently. Thanks for the tips, it confirmed the solution to my problem.

How to get Access to auto save my VBA code changes

I'm fed up with Access crashing after I've written and run some code and forgot to manually save it and hence all the new code is gone. How can I get Access to automatically save my VBA code upon, say, compile or run? I don't see any settings in VBA and I don't see any answers to a Google search. (Also, I don't think I've faced this problem in any other IDE.)