# Scripts, scripts, scripts!

**URL:** <https://community.glideapps.com/t/scripts-scripts-scripts/18965>\
**Category:** Ask for Help\
**Created:** [November 26, 2020, 6:15pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965 "2020-11-26T18:15:21Z")\
**Posts on this page:** 20\
**Page:** 9

<div class="post-metadata">

**Author:** ![V88](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/v88/32/90054_2.png) [@V88](https://community.glideapps.com/u/V88)\
**Post date:** [March 1, 2021, 6:34pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/163 "2021-03-01T18:34:57Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/2/c/2ce0d30ad2b10c4528eedd664950aa6a4c60bea1.jpeg)  
Add the new module to download the file  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/0/3/03e6aed3d573df4f5bd3e54a454017277d48d59f.jpeg)  
Tell it the file to download based on the FileId of the previous module  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/1/713a18a803bba69ee8b9ff37da8d2c6fc9f60932.png)  
Feed this modules Data output into the Parse CSV module

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [March 1, 2021, 7:25pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/164 "2021-03-01T19:25:11Z")

</div>

@V88_Google Thank you sir! Working as expected. Glide community is the best community!! 🥳

> **Summary**
>
> ![Screen Shot 2021-03-01 at 2.27.49 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/8/d8b05696f3e48a9c039280de57ce81ba56c05df7.png)

I’m going to work on scenario 1 now…Email attachment \>Parse CSV to sheets

I’ll report back, hopefully I don’t I hit another snag 😉

---

<div class="post-metadata">

**Author:** ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)\
**Post date:** [March 1, 2021, 8:00pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/165 "2021-03-01T20:00:23Z")

</div>

In this forum thread near the top is a script written to import CSV files directly into sheets for Glide.

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [March 1, 2021, 8:07pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/166 "2021-03-01T20:07:11Z")

</div>

I wouldn’t have the necessary skill to take the script over the finish line. I need only parts of the CSV in specific ordered columns.

I could benefit from a more organized Data Structure but it’s a tangled web of Named Ranges and Uniques in there…

---

<div class="post-metadata">

**Author:** ![Pablo\_Sanz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pablo_sanz/32/16415_2.png) [@Pablo\_Sanz](https://community.glideapps.com/u/Pablo_Sanz)\
**Post date:** [March 2, 2021, 4:58am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/167 "2021-03-02T04:58:02Z")

</div>

thanks, i’m checking it  
✌🏾

---

<div class="post-metadata">

**Author:** ![Pablo\_Sanz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pablo_sanz/32/16415_2.png) [@Pablo\_Sanz](https://community.glideapps.com/u/Pablo_Sanz)\
**Post date:** [March 2, 2021, 8:03am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/168 "2021-03-02T08:03:27Z")

</div>

You know, I’m trying to read with GAS a JSON file from a payment gateway webhook, in theory, I think I have the code, but when I do the tests nothing happens.

this is the code:

function doGet(e) {

return HtmlService.createHtmlOutput(“request received”);

}

function doPost(e) {

```
var parametros = JSON.stringify(e.postData.contents);

parametros = JSON.parse(parametros);

var data = JSON.parse(e.postData.contents);

var id_Transaccion = data.IdTransaccion;

var fecha_Transaccion = data.FechaTransaccion;

var resultado = data.ResultadoTransaccion;

var monto = data.Monto;

var cliente = data.Nombre;

var correo = data.Email;

var sheet = "Confirmacion de pedidos";

var hoja = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheet);

var ultima_fila = Math.max(hoja.getLastRow(),1);

hoja.insertRowAfter(ultima_fila);

hoja.getRange(ultima_fila + 1, 1).setValue(id_Transaccion);

hoja.getRange(ultima_fila + 1, 2).setValue(fecha_Transaccion);

hoja.getRange(ultima_fila + 1, 3).setValue(resultado);

hoja.getRange(ultima_fila + 1, 4).setValue(monto);

hoja.getRange(ultima_fila + 1, 5).setValue(cliente);

hoja.getRange(ultima_fila + 1, 6).setValue(correo);

hoja.getRange(ultima_fila + 1, 7).setValue(data);

SpreadsheetApp.flush();

return HtmlService.createHtmlOutput("post request received");

```

}

I would appreciate if you could review it and tell me something that I am overlooking.

✌🏾

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 2, 2021, 8:08am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/169 "2021-03-02T08:08:00Z")

</div>

Insert the following line:

```auto
console.log(parametros);

```

That will show you if anything is being posted to the webhook.

---

<div class="post-metadata">

**Author:** ![Pablo\_Sanz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pablo_sanz/32/16415_2.png) [@Pablo\_Sanz](https://community.glideapps.com/u/Pablo_Sanz)\
**Post date:** [March 2, 2021, 8:18am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/170 "2021-03-02T08:18:41Z")

</div>

when I run the code from GAS it throws me the following error: TypeError: Cannot read property ‘postData’ of undefined

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 2, 2021, 8:44am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/171 "2021-03-02T08:44:52Z")

</div>

So that suggests that nothing is being posted to the webhook…

---

<div class="post-metadata">

**Author:** ![Pablo\_Sanz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pablo_sanz/32/16415_2.png) [@Pablo\_Sanz](https://community.glideapps.com/u/Pablo_Sanz)\
**Post date:** [March 2, 2021, 8:55am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/172 "2021-03-02T08:55:38Z")

</div>

well, the idea is the following:

1- from glide through a webview the client makes the payment with his credit card  
2- The payment gateway receives the transaction and notifies through a webhook  
3- GAS receives the webhook and writes the details on the spreadsheet  
4-finalize the purchase process in glide

that’s the general idea of what i’m trying to do, but i’m in an alley with the script

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 2, 2021, 8:58am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/173 "2021-03-02T08:58:35Z")

</div>

Just based on the error message you have, it appears that it is failing at step 2.  
Sorry, I can’t really offer much more than that.

---

<div class="post-metadata">

**Author:** ![Pablo\_Sanz](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pablo_sanz/32/16415_2.png) [@Pablo\_Sanz](https://community.glideapps.com/u/Pablo_Sanz)\
**Post date:** [March 2, 2021, 9:01am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/174 "2021-03-02T09:01:31Z")

</div>

I understand your point, and I appreciate your time … verify that the payment gateway will send the confirmation using integromat, and with that service if I found the configuration, but I need it in GAS

---

<div class="post-metadata">

**Author:** ![Richard\_Chow](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/richard_chow/32/842_2.png) [@Richard\_Chow](https://community.glideapps.com/u/Richard_Chow)\
**Post date:** [March 5, 2021, 3:19am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/175 "2021-03-05T03:19:34Z")

</div>

@Darren_Murphy @Manan_Mehta

I copied this script but wasn’t able to make it run. I bet it’s due to my poor understanding on the whole thing and the trigger setting.

Any tutorial or how can I get it started?

---

<div class="post-metadata">

**Author:** ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)\
**Post date:** [March 5, 2021, 12:35pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/176 "2021-03-05T12:35:31Z")

</div>

@Darren_Murphy hi!  
Возникли проблемы с созданием столбцов, определяемых пользователем, для временного хранения входного значения.  
Как это сделать?

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [March 5, 2021, 12:41pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/177 "2021-03-05T12:41:55Z")

</div>

[https://docs.glideapps.com/all/reference/data-editor/user-specific-columns](https://docs.glideapps.com/all/reference/data-editor/user-specific-columns)

---

<div class="post-metadata">

**Author:** ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)\
**Post date:** [March 5, 2021, 12:46pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/178 "2021-03-05T12:46:04Z")

</div>

> [@Antonoff](#):
>
> для временного хранения входного значения

Thanks. Yes, i read it. It is not clear exactly in the part “for temporary storage of the input value”.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 5, 2021, 1:04pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/179 "2021-03-05T13:04:52Z")

</div>

Going back to my example, the template column is a concatenation of 3 columns: Name, Age & Sex

- I would have 3 corresponding User Specific Columns: usc-name, usc-age, and usc-sex
- In my form layout, I would have 3 input components. Each of those would use one of those user specific columns as the target
- I would then have a second template column that concatenates the 3 user specific columns
- And these two template columns are used to create a relation column, which in turn will indicate whether or not a duplicate has been created

Does that explanation help?

---

<div class="post-metadata">

**Author:** ![Antonoff](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/antonoff/32/22045_2.png) [@Antonoff](https://community.glideapps.com/u/Antonoff)\
**Post date:** [March 5, 2021, 6:00pm UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/180 "2021-03-05T18:00:47Z")

</div>

Yes, thanks)  
So I understood you correctly the first time

---

<div class="post-metadata">

**Author:** ![Richard\_Chow](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/richard_chow/32/842_2.png) [@Richard\_Chow](https://community.glideapps.com/u/Richard_Chow)\
**Post date:** [March 6, 2021, 3:41am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/181 "2021-03-06T03:41:42Z")

</div>

According to the script, I am having difficulty to execute the notification.

```auto
    function Twilio() {
     
  var ss = SpreadsheetApp.getActive().getSheetByName("Notifications");
  var values = ss.getRange("A2:H").getValues();

  for (var i in values) {
     var row=i;
     var r = +row + 2;
     if (values[i][5] != '' && values[i][7] == '' ) {
       var number = values[i][5]
       var message = values[i][6]
       
       function sendSms(to, body) {
  var messages_url = "Your Twilio URL";

  var payload = {
    "To": to,
    "Body" : body,
    "From" : "Twilio phone number"
  };

  var options = {
    "method" : "post",
    "payload" : payload
  };

  options.headers = { 
    "Authorization" : "Basic " + Utilities.base64Encode("Your API Code")
  };

  UrlFetchApp.fetch(messages_url, options);
}
       try {
      response_data = sendSms(number, message);
      status = "sent";
    } catch(err) {
      Logger.log(err);
      status = "error";
    }
    ss.getRange(r, 8).setValue(status);
       
      
         
     }  
    if (values[i][5] == '' && values[i][7] == '' ) {
         Utilities.sleep(1000);
      var mail = values[i][2]
       var message = values[i][6]
       var row = +i + 2
       ss.getRange(row, 8).setValue("Email Sent");
         MailApp.sendEmail(mail, "Your Subject line", message, {name:"name of sender"})
        
       SpreadsheetApp.flush();
       }
  }
}

```

Can someone assist? @Darren_Murphy T,T

Stucked at triggering.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [March 6, 2021, 4:18am UTC](https://community.glideapps.com/t/scripts-scripts-scripts/18965/182 "2021-03-06T04:18:10Z")

</div>

What happens when you try to execute the script?  
Do you see an error message?  
Sharing that might help us to help you…

PS. When posting code, please enclose with 4 back ticks (````) before and after (I fixed that for you)

[Previous page](https://community.glideapps.com/t/scripts-scripts-scripts/18965.md?page=8)

[Next page](https://community.glideapps.com/t/scripts-scripts-scripts/18965.md?page=10)
