I hope someone has some insight into this issue. I'm trying to execute script in google sheets. The script runs fine when manually executed. We need to use service account for this purpose. API executable was published, I have .p12 file for authentication, there is only 1 function to run and we're getting the 404. I'm using some c# code from DEVs site and that should work as per the article. Has anybody else run into this? Is there an example that shows how to do it correctly? This is what i've based my code on, to no avail... https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth
Thanks for any ideas!
Edit: Thanks Ares - my specific problem is that while following devs example code, I can't execute google script and receive the before mentioned 404 error.
You cannot use C# in GAS. Google Apps Script is based on Javascript. The link you provided shows how to code an example in .NET, which is neither GAS or C#, so I'm confused at why you would follow that example at all.
Regardless, any code that can be used in a Google Script site will say that it is for a .gs or an HTML file.
Remember that Google has many API's that work across multiple languages. GAS is what they want to push, but not every guide they make is aimed at GAS.
I assume the 404 is from using unreadable code.
Related
I am trying to retrieve the source code of a website/project which was made for me on fiverr. I've been made the owner of the project.
I followed the advice on previous links (below) to get the source code:
Is it possible to get the source code of a Google Firebase (or Google Cloud Platform) project?
Is it possible to retrieve Firebase Cloud Function source code?
Get code from firebase console which I deployed earlier
For some reason my google cloud functions list does not show “source” as stated in previous answers picure with source missing in functions list.
Is there another way to access the source code from google cloud?
Appreciated
J
So its been over a year and a bit more experience with Firebase. The correct answer is you cannot technically access the source code because the source code contains the html,css and javascript files which are deployed to the Firebase server and are back-end (server side). What you view on the website is only the front-end client side code and is not the full picture.
Whenever you get a website developed for you, you should always have the developer pass on all the html,css and javascript codes so that you can always deploy it when needed.
When attempting to embed Google’s sample provided for the Tasks API (code found here) into Google's Classic Sites I get the dreaded “script.google.com refused to connect”. The logging error is "Tasks" is not defined at getTasksLists(simpleTasks:15). Details:
When I embed this same script into Google's New Sites, the UI does show, but the drop-down continues to display “Loading…” (see screenshot below), however if I click on the link provided to view my “Google Tasks” it does go to my Tasks in a new window.
This runs successfully directly from Google Apps Scripts, showing the “Authorization required” pop-up and allowing me to sign in and accept permissions. However, when embedded into both New and Classic sites, it does not request any authorization.
Steps I've taken embedding into Classic Sites (where it needs to be):
from URL provided above: copied code exactly as is into a new Scripts project (nothing altered or added).
from Scripts: deployed it as a Web App, copied the URL provided (the code provided in the link above has not been altered in any way by me)
from Scripts: enabled Tasks API though Resources, Advanced Google Services
from Sites: edit page, Insert Apps Script, pasted URL (i.e. https//script.google.com/macros/s/...5Ym41qn/exec)
Other things I've tried:
from Sites: embedding URL as an iFrame gadget (same results)
solution given here: How to add Google Drive Scripts project into Google Sites? (same results)
days of research into Google's documentation (for Sites, APIs, Scripts, Cloud Platform, you name it)... (various results but nothing productive)
I am very new to working with Sites, Scripts, the Cloud Platform, etc. so apologies if I am missing some obvious steps here. Any guidance would be truly appreciated!
Leora
UPDATE [03-21-19]:
I was able to get this working finally! Although not posting as answer just yet as I haven't figured out the exact change that was brought success.
I thought it was by changing the option within Sites' Publish / Deploy as web app... / Execute the app as: from 'ME' to 'USER' (after doing that it worked), but when I changed it back to make sure that was it, it still worked?
I will play around with it more this weekend and update when I come to a definitive solution.
Thanks to anyone who took the time to help me out here, and if anyone does have any guidance on what's happening here, I'd love to know.
I'm trying to ultimately silently print using Google Cloud Print from a POST function that is called from code on a website.
I succeeded in testing cloud printing using my account and my printers using a form submit.
(you can see the code that worked for that here: https://stackoverflow.com/questions/23975931/programatically-change-file-name-in-google-chrome-print)
The form submit didn't ask me for any authorization that I could tell. It asked me for xsrf. I stumbled across the answer for this by testing here:
https://www.google.com/cloudprint/simulate.html
So my question is can some amazing person please take pity on me and post the entire code for POST to submit a print job to GCP INCLUDING the format for authorization and where I get that info?
I have read the manuals for cloud printing and the info on how to get an oauth (although I don't understand that part yet)
I am missing something that will be obvious to people who have done this before.
I have tried the php code at github - although I do not usually code in php.
I have programmed a lot of API's and there is something I am just missing here.
Thank you profusely in advance!
i developed this simple library in python. https://github.com/escube/GoogleCloudSpooler
You cna use as you wish.
I developed a server version as well, but the lib used is the one in this project.
Try to use it and tell me if you have problem with that, I'll be pleased to help.
You could try using an alternative service such as PrintNode which has an excellent API and is very simple to use.
I have been using the excellent ScriptDB visualiser to help develop a google-apps-script.
This uses the HTMLService and worked last week, but now I cannot get it to work.
The HTML still is served & loads, but no javascript runs. When a button is clicked the error console (in firefox) gives the error;
Error: shouldn't happen: ES5/3 object passed to makeDOMAccessible
Source File: https://ssl.gstatic.com/caja/5346m/es53-taming-frame.opt.js?debug=1
Line: 1788
I suspect some Caja issue, but I went to the Caja playground and could not make any headway.
Any suggestions how to get this working again.
As the message suggests, this shouldn't happen.
That is, this is an internal bug in Caja or possibly Google Apps Script's use of Caja. Please report it on the Caja issue tracker including a (preferably as short as you can make it) example of HTML which causes the error (preferably when run in the Caja Playground, but if not then in Google Apps Script).
I'm using a general Google Apps Script function to be able to read, prettify and publish Google Apps Script code and data from a scriptdb. I've recently extended it to publish code from a Gist or from a given web address. The purpose it to be able to include live code snippets in documentation. I have it all working fine for most use cases, including for html and other server based files.
However, php files get executed rather (than returned as text/html) when accessed with urlFetch(). I know it's along shot, but does anyone know of any header options, or indeed any other technique, I can use to generally override this?
What you are asking for would be a major security problem. It is not possible to ask for the php-code instead of the result of the php script execution. Well, not exactly - it is up to the Server hosting that php script what it does with it. If there was no php extension installed on the server it would return the php code or the file as whole.
But to help with your request:
You should ask the server administrator / website owner if the code is available somewhere and if so what the url is. I believe there is a php extension that allows files to be looked at with colors, text indent and everything - but i think it is disabled by default (or you need to rename your php file to something else)