0

Currently I am using Google Sheets as a database in my app. I am aware of the usage quotas, but I am confused about which services I am using and what the limitations are. My app just passes values to Google Sheets. I would like to get some answers for the following questions:

  1. Triggers total runtime = 90min/day
    Is this the total time that the script would run in a day?

  2. URL fetch calls = 20000/day
    Does it mean I can call script url 20000 per day from my app?

  3. Script runtime = 6min/execution
    Please explain what this quota means

Web App code:

private void setItems() {

    StringRequest stringRequest = new StringRequest(Request.Method.POST, script,
                        new Response.Listener<String>() {
                            @Override
                            public void onResponse(String response) {

                        },
                        new Response.ErrorListener() {
                            @Override
                            public void onErrorResponse(VolleyError error) {

                            }
                        }
                ) {
                    @Override
                    protected Map<String, String> getParams() {
                        Map<String, String> parmas = new HashMap<>();

                        //here we pass params
                        parmas.put("action","addItem");
                        parmas.put("teamname",teamname);
                        parmas.put("p1",finalp1);
                        parmas.put("p2",finalp2);
                        parmas.put("p3",finalp3);
                        parmas.put("p4",finalp4);
                        parmas.put("p5",finalp5);

                        return parmas;
                    }
                };

                    int socketTimeOut = 50000;// u can change this .. here it is 50 seconds

                    RetryPolicy retryPolicy = new DefaultRetryPolicy(socketTimeOut, 0, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
                    stringRequest.setRetryPolicy(retryPolicy);

                    RequestQueue queue = Volley.newRequestQueue(JoinContest.this);

                    queue.add(stringRequest);

Server-side code:

var ss = SpreadsheetApp.openByUrl("MY URL");

var sheet = ss.getSheetByName('Main');

function doPost(e){
var action = e.parameter.action;

if(action == 'addItem'){
  return addItem(e);

}

}

function addItem(e){

var teamname =  e.parameter.teamname;

var position  =  sheet.getLastRow(); // Item1

var p1 = e.parameter.p1;

var p2 = e.parameter.p2;

var p3 = e.parameter.p3;

var p4 = e.parameter.p4;

var p5 = e.parameter.p5;  
sheet.appendRow([position,teamname,p1,p2,p3,p4,p5]);

return ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);

}
Marios
  • 26,333
  • 8
  • 32
  • 52
  • Simultaneous executions:30 applies. Daily total trigger runtime *might* apply: 90min/day, IF Web-app published to execute as "Me". – TheMaster Apr 16 '20 at 12:16
  • I refered Many Post But I was Getting Confused – ICEBlizzard Apr 16 '20 at 12:24
  • Simultaneous executions Means 30 User can Save Data TO Sheets Simultaneously? – ICEBlizzard Apr 16 '20 at 12:25
  • *Is this the total time that the script would run in a day?* Yes *Does it mean I can call script url 20000 per day from my app?* No *Script runtime = 6min/execution* 1 call to ``doPost()`` cannot run more than 6 minutes – TheMaster Apr 16 '20 at 13:13
  • Total 6 mins a day? – ICEBlizzard Apr 16 '20 at 13:25
  • I mean if user call dopost(),assume it took 1 min.now a second user calls do post() will it be total 2 mins or 1 mins? – ICEBlizzard Apr 16 '20 at 13:27
  • 1
    At a time, not total (it would be a ridiculously low bar if so). A function has to return in under 6 minutes, otherwise the execution is stopped abruptlly and an error will be thrown. When a request hits your app, the `doPost()` function is executed, and its runtime must be under 6 mins – Oleg Valter is with Ukraine Apr 16 '20 at 13:29
  • 1
    *I mean if user call dopost(),assume it took 1 min.now a second user calls do post() will it be total 2 mins or 1 mins* 6 minutes per execution. it'll be 1 minute per execution and 2 executions. Trigger runtime is 90 min/day, if script executes as "Me" – TheMaster Apr 16 '20 at 13:34
  • You Mean when a user call a dopost() the process or execution should finish in 6 mins? – ICEBlizzard Apr 16 '20 at 13:38
  • A Final Question assume i have 2 app script so trigger runtime will b 90 mins for both or a particular script? – ICEBlizzard Apr 16 '20 at 13:52
  • Not documented, but it should be for both. – TheMaster Apr 16 '20 at 14:34
  • Oke thanks for your responce – ICEBlizzard Apr 16 '20 at 14:37

0 Answers0