# Script for for to compare

**URL:** <https://community.glideapps.com/t/script-for-for-to-compare/23163>\
**Category:** Ask for Help\
**Created:** [February 21, 2021, 6:00am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163 "2021-02-21T06:00:26Z")\
**Posts on this page:** 12\
**Page:** 1

<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:** [February 21, 2021, 6:00am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/1 "2021-02-21T06:00:26Z")

</div>

Hi there!  
I need to create a script for to compare two tables. If the value in the table rows matches, then the script will notify the user. Where can I read about it?

---

<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:** [February 21, 2021, 6:05am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/2 "2021-02-21T06:05:33Z")

</div>

You’ll find examples of various scripts in [this thread](https://community.glideapps.com/t/scripts-scripts-scripts/18965).

How would the user be notified - email?

As an alternative to scripting, I’d recommend also checking out automation tools such as [Zapier](https://zapier.com/) or [Integromat](https://www.integromat.com/en).

---

<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:** [February 21, 2021, 6:19am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/3 "2021-02-21T06:19:49Z")

</div>

> [@Darren\_Murphy](#):
>
> How would the user be notified - email?

No, push in app

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 21, 2021, 9:24am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/4 "2021-02-21T09:24:54Z")

</div>

So on adding a new row to table A, if it matches a row in table B then it should notify the user and vice versa?

---

<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:** [February 21, 2021, 9:26am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/5 "2021-02-21T09:26:21Z")

</div>

Push notifications will not work on IOS, and will only work under very specific circumstances on Android.

> [@Notification push](https://community.glideapps.com/t/notification-push/856/2):
>
> Only people who: have also commented on the thread and who are not the author and are not viewing the page when the comment happens and are on Android and have accepted Push Notifications when posting their own comment will be notified.

---

<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:** [February 21, 2021, 9:42am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/6 "2021-02-21T09:42:54Z")

</div>

I thought this was the wrong algorithm. better like this: the script compares two tables, and if there is a match (exact or in the period), then it copies the row to the third table, and a notification is already received from there

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 21, 2021, 11:05am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/7 "2021-02-21T11:05:37Z")

</div>

Then what I would do is create 2 custom forms for the addition of rows to two tables.

In those forms, writing to user-specific columns, I would have a relation to check if:

- When I add to table A, if the input info matches a row in table B, write both to table A and table C, and show an in-app notification. If no, only write to table A.

- Same for table B, if the input info matches a row in table A, write both to table B and table C, and show a notification. If no, only write to table B.

---

<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:** [February 21, 2021, 3:38pm UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/8 "2021-02-21T15:38:53Z")

</div>

How to do it?

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 21, 2021, 11:45pm UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/9 "2021-02-21T23:45:16Z")

</div>

Where are you getting stuck with it? How are you currently letting users add rows to each sheet?

---

<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:** [February 24, 2021, 8:50pm UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/10 "2021-02-24T20:50:46Z")

</div>

while also  
function moveRows()  
{ var sheet = SpreadsheetApp.openById(“id”);  
var sheetname = sheet.getSheetByName(‘Feed’);  
var sheetname = sheet.getSheetByName(‘Alarm-list’);  
var sheetname = sheet.getSheetByName(‘Notifications’);  
var rng = sheet.getRange(‘A1:Z200’);  
var rngA = rng.getValues();  
Logger.log(“Check”);  
}  
}

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [February 24, 2021, 11:22pm UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/11 "2021-02-24T23:22:41Z")

</div>

Can you go through what that function specifically does in your case?

---

<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:** [February 25, 2021, 9:14am UTC](https://community.glideapps.com/t/script-for-for-to-compare/23163/12 "2021-02-25T09:14:02Z")

</div>

Writhe here [Scripts, scripts, scripts! - #142 by Antonoff](https://community.glideapps.com/t/scripts-scripts-scripts/18965/142)
