V
V
Vladimir Zuev2020-07-21 08:04:38
Google Apps Script
Vladimir Zuev, 2020-07-21 08:04:38

How to run a function in a gs file?

Hello.
We need to run the function in the gs file.
Tried like this

let info = [col_value,profit_ratio,manager_ratio, ad_ratio]; 
  alert(info);
 google.script.run.withSuccessHandler().receiveData(info);

Error pops up
Uncaught  at receiveData (Code:23)

qe @ 3872875002-mae_html_user_bin_i18n_mae_html_user__ru.js:54
sf @ 3872875002-mae_html_user_bin_i18n_mae_html_user__ru.js:68
(anonymous) @ 3872875002-mae_html_user_bin_i18n_mae_html_user__ru.js:11
eg.K @ 3872875002-mae_html_user_bin_i18n_mae_html_user__ru.js:95
$d @ 3872875002-mae_html_user_bin_i18n_mae_html_user__ru.js:47
Wd @ 3872875002-mae_html_user_bin_i18n_mae_html_user__ru.js:48
Ud.b @ 3872875002-mae_html_user_bin_i18n_mae_html_user__ru.js:44


Here is the function in gs file
function receiveData(data){
  alert("Привет");
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("data");
  sheet.appendRow(data);  
};

What is the correct way to run a function in a gs file? Please help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mityayka1, 2020-07-21
@vladd56

The gs functions do not support alert by default. 5f1686f8f2819074813474.jpeg
Here is an example using google.script.run

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question