function doGet(e) {
return aggiorna;
}
function aggiorna(e)
{
var programma=SpreadsheetApp.getActive();
var documento=programma.getSheetByName("Elenco");
var testo="";
var righe=documento.getDataRange().getValues();
for (var riga=0;riga<righe.length;riga=riga+1)
{
testo=testo+righe[riga].join(",")+"\n";
}
return ContentService.createTextOutput(testo).setMimeType(ContentService.MimeType.TEXT);
I debugged and the testo variable correctly contains the text string.
also I read that the variable (e) of the ToGet function is undefined (is this correct?)
You could just write your google apps script like this and it will work:
function doGet() {
var programma=SpreadsheetApp.getActive();
var documento=programma.getSheetByName("Elenco");
var testo="";
var righe=documento.getDataRange().getValues();
for (var riga=0;riga<righe.length;riga=riga+1)
{
testo=testo+righe[riga].join(",")+"\n";
}
return ContentService.createTextOutput(testo);
}
The /dev link will not work through the AI2 app, you need to use the published link ending with /exec. If you have made changes to your google apps script, make sure you republish the script, and also check that the script url displayed is the same as the one in your AI2 app.
I set my script to run for Anyone with a Google account
the screenshot is from the mobile app and shows a series of lines that I suppose are written in html.
if in the blocks I ask for the url, the app returns the address correctly. If I ask the other two he gives me the correct information. Only when I ask for the content does it give me the html information
Are you using Google Workspace - inside a domain? This could be the reason you do not see "Anyone"
If this is the case, your Admin (if it is not you) will need to give you wider permissions. Alternatively, use a personal gmail account, but this may be an issue if using internal "google" data.
I use my google. I'm using the new editor, which also lacks the classic menu. Anyway I restored the previous editor and in this case I found the wording "anyone".
Finally I deleted all the lines of the doGet () function and typed only the line
return ContentService.createTextOutput ("Hello World");
But even in this way the mobile app does not return the html code
a web app requires a doGet(e) or a doPost(e) function AND a ContentService or HTMLService return in order to work. So your basic web app would, as a minimum, need to be:
function doGet() {
return ContentService.createTextOutput("Hello World");
}
I am really not sure where you problem lies, I suggest you delete the script you are working on and start again following my guide, using the legacy script editor.
First Step Solved. The problem was just getting anyone authorized.
There are two sections in the deployment definition:
1st - Run as (I entered "user accessing the web application). In the 2nd section it only showed the two options we talked about in the post above.
I changed in the 1st section with "run as me ('my email' -xxxx@gmail.com) and finally in the 2nd section" Users authorized to access "I was able to insert the words" anyone "