Answer the question
In order to leave comments, you need to log in
How to replace a library with a web application in Google Script?
At the moment, the following code is inserted as a script in many tables:
function append()
{
SpreadsheetApp.getUi().alert('Всё сохранилось! Спасибо!');
Library.called_by_button();
}
function called_by_button(data_to_be_sent){
var date = new Date();
var ss1 = SpreadsheetApp.getActive();
var id = ss1.getRange("B1").getValue();
var data = {
'date': date,
'a1': id
var options = {
'method' : 'post',
'payload' : data,
muteHttpExceptions: true
};
// This is probably the best way to use UrlFetchApp() and handle errors.
var url = 'https://script.google.com/a/***/exec';
try {
var response = UrlFetchApp.fetch(url, options); // Post the data (make the HTTP Request)
var responseCode = response.getResponseCode();
if (responseCode === 200) { // 200 = SUCCESS
Logger.log("url_fetch() response code %s ", responseCode);
return response;
} else {
Logger.log(Utilities.formatString("url_fetch() Request failed for: %s, Expected 200, got %d",url,responseCode ));
return false;
//
}
}// end Try
catch (err) {
Logger.log(Utilities.formatString("url_fetch() Request failed (underlying network error). %s, response code: %s",err, responseCode));
return false;
}
}
Answer the question
In order to leave comments, you need to log in
You probably don't need to change anything in your code. We need to try to change our understanding of the problem. This is not a desktop office, where I threw a couple of symlinks, and the program is happy.
You must change the approach to solving the problem. One of the best options is to use a web application as a central program. But it has its limitations, for example, to send an alert to some Table, you have to puff. But if the user clicks on a button in the web application itself, then you can issue an alert on his side.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question