Hey there stranger!

Sign up to get access.

New Syntax for WhatChanged Formula in Google Script

About this Tutorial

revisiting the "what changed" custom function I built in a past video. Showing you more apps script

Video Transcript

 Hello. So I am revisiting the what changed the custom function, uh, and how to learn the double loop because I've learned something new. Um, Dylan Brooks saw the video on YouTube. I'm putting this video on YouTube as well. If you're a better sheets member already, you got to see this video first. Uh, the link to the sheet and the code is in the description.

If you are not a better Sheets member yet, consider uh, signing up better sheets.co. You can get it as, as of right now, you can get it as low as $19 lifetime value, uh, deal through AppSumo. But that will be changing at some point in the future. Um, might be a.  different price or a monthly price. Um, but if you're watching this on YouTube, uh, you will be able to see the code that Dylan wrote, and you can copy that if you wish.

So, um, but all better Sheets members in the description is linked to this sheet. You get the sheet, you get the code. , you get everything that you want out of this. So what I did in the prior video is I created this custom function called What Change. And it looked at two sentences or two cells and said, what are the, uh, words that are added and what are the words that are deleted?

This is really useful for, uh, copywriters, copy editors. Anyone who wants to say, uh, either show their work or if you want to see other people's work. Say you're a manager or you're trying to learn like. What, what changed, and you really like want to just execute the changes and then catalog those changes in another cell.

Um, this is, this is a really cool way to do it. You could rewrite tweets. You could, um, if you're an SEO agency, you could say, here's like, here's a list of seo. Keywords. Here's all the changes we would make to that. Um, you could, if you're a copywriter, copy editor working for someone else, you could say, here's all the changes I made, and here's literally the changes.

Um, here's the end result. And then here are the changes. Really, really cool, uh, implementations you can use for this. But I wanted to share with you what Dylan did. He shared this on Twitter. What he did is he, one, he was, he was interested that you couldn't, uh, that you could so easily put in JavaScript in a script into a Google sheet.

And then he wrote this. He said, let what changed equals first and second. And he used this set, which is like an iterator, and I'm just learning it now, but it works . Like what happened is, first I was like, I don't think this. Functionality or it says format or syntax works in Google Scripts. That's my first thought.

This looks like pure Java script. It even has these back ticks where it combines a lot of stuff that I had differently. Um, here I'll show you here. Uh, this is what I originally had here where I created these arrays. I created empty arrays and then, uh, just looked through, through a couple of the edge cases first.

Um, I go through this much more in the other video, and then I went through a double four loop and then said like, okay, compare each item to every item in the other one. Does it include it? And if it doesn.  then say, Hey, this is deleted, or this is added. And here I even have this, uh, all text equals added and deleted.

And I added this, um, uh, new line. And again, I go much slower through it in the other video, but what Dylan did is he used pure JavaScript. And at first I was like, well, I don't think the this let will work. So I wrote, I rewrote it out. Everything outside of the brackets I rewrote, um, with this function, the change.

And, and I was like, well, does this set, cuz this set doesn't look like it works. It doesn't, it doesn't look and feel like the same. Way that, like Google Script works like this. Uh, the, they turn purple, these, these ifs, and the let, and this the variable turns to blue. And then here in these back ticks, this added does turn to blue.

This deleted does turn to blue, but I had no idea what these three dots do. And I was like, I don't think this is gonna work. But I did write it all out and I just tried it and it works. So check this out. So I'm just gonna try the new function.  and obviously like the, the test is, it doesn't re result in the same thing and it does the change.

The first thing we want to check is b2. Second thing is b3 let it load loading. And there it is. That is the same. And now if we drag it down,

we see nothing changed down here. That is correct. And then, , all of these are the same. And that's really, really interesting to me. Thank you Dylan, so much. Um, for this, because also I cha I check this, let, which normally when I'm writing Google Scripts, I write them with this function and then the name of the function and then what are the, uh, the things that are gonna be inside of it.

What are the variables I wanna grab and then this function. But what we did here, what Dylan. , and again, it doesn't look like it works because nothing changed. Like the ide, the, the, the, the coding like environment here doesn't change this, these first and second to blue. So I wouldn't know if this worked, but I just tried it.

I said, let what the change equals first and second, and then use this arrow function, which is common in JavaScript now and. . So let's try it now. So now we're gonna try what? The change as the custom function. And let's put it, let's, let's, uh, make this a little bit smaller. Let's put it right here. So same thing, we're gonna use it as a custom function.

What the change. And we're gonna do b2, b3, same, same implementation. And we're gonna see what happens. I'm gonna just make this a little bit bigger there.  and we get the exact same result, right? And ideally we're gonna get the same result here. Um, then even we're gonna get, if it's blank down here, we're going to get another there.

It's nothing to compare to. Let's look at this edge case. Perfect. So this absolutely works exactly how we wanted it to work. And it uses pure JavaScript that you can copy and paste JavaScript from, um, other places and use it in Google Scripts. This is a really interesting, um, thing to know of how Google Scripts, if you ha, if you didn't know this before, now you know if you did know this before, now you see an implementation of it.

Um, I learned something new every. And I hope you learn something new too. Uh, feel free to ask questions and reply in this, uh, the video here, or, um, this video will be on YouTube. If you are watching on YouTube, subscribe. And we're gonna learn something new about Google Sheets all the time. I was gonna say every day, but I'm not literally posting every day.

So, um, but if you do want access every single day to Better Sheets videos, and there's like 145 videos available to members right now, go check out better sheets.com. Bye.

Courses

Sheet Stories / Video Notes + ADDED: Email Notifications

00:00:00

ChatGPT Clone in Google Sheets Part 2

Fast FAQS

Why Different Cell References in AI Integration in Sheets?

Show Sheet Tabs Based on Edit

Add Title Case to Google Sheets

How to Power Testimonials with Google Forms and Sheets

Getting Started Coding in Apps Script

Seek Errors When Coding Apps Script

Think Like a Programmer: Develop The Mindset of an Apps Script Coder

ChatGPT Clone in Google Sheets Part 1

Embed a Number in a Website from a Google Sheet

Create Navigation Like A Book or Presentation

Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet

00:29:08

Hold a Giveaway Raffle in a Google Sheet

Embed a Headline in a Website from Google Sheets

Capture Emails from Website Form to a Google Sheet (Without Zapier)

Quickstart Tutorial OpenAI API in Google Sheets

Create a new Spreadsheet from just a Name in a Sheet.

00:05:21

Bjarne Asks: Can I show the Last Time of the Last Edit in a sheet?

00:05:43

Email Yourself a Cell from a Google Sheet, Every Day

OpenSea Data Inside Sheets

Create an Email Campaign Stats Calculator

00:35:13

Twitter App Clone in a Google Sheet

Dylan Asks: How to Automatically Delete Rows If Cell Contains Value

Highlight Row as You Move Your Cell Selection

Create a Timer with Apps Script

LinkTree in a Google Sheet

00:11:22

Password Protecting Data In a Google Sheet

Automatic Weekly Backup of Google Sheets

Create a CPM Custom Function (Create Better Calculators!)

Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script

00:12:29

What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users

Sync Two Tabs Without ImportRange()

Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.

00:00:00

Password Protecting Data In a Google Sheet Part 2 The Basics

Benoit Asks: How to Convert Case

00:07:35

Learn to Code in Google Sheets, For Programmers

Add a Checkbox to Turn on Dark Mode

00:05:10

Write Your First Script

00:08:31

Find Keywords in Any Column. Create quick search dropdown to find keywords

00:09:37

Basic CRM - Add a Powerful Script To Move Row Based on Status

How To Improve: 1,000 Business ideas: Business Idea Generator

00:11:20

Let's Make a Bookmarklet!

00:12:37

Troubleshooting Bitly in a Google Sheet Script

00:07:07

Unique Features - Design a Better Dashboard Part 2

00:04:13

How To Set Up Stripe Webhook to Google Sheets with Google Script

00:22:10

How to Edit a Macro

00:08:22

Sheet Stories / Video Notes + Clear 24 Hour Old Videos

00:35:10

Add A Timestamp to Task Lists (without Now Formula)

00:07:44

Make your Custom Functions Like Native Functions | Custom Function Autocomplete

00:17:58

Create a Changelog Between 2 Cells Custom Function | To learn Double For Loop

00:23:26

New Syntax for WhatChanged Formula in Google Script

00:07:14

How to Record Macros

00:06:20

2 Ways to Delete Lines Quickly (CAREFUL, it's a script!)

00:09:53

Deep Inside Dark Habits Google Script

00:18:54

How to Trigger Macros Daily

00:06:58

5 Ways to Create Coupon Codes | Create UUIDs

Create a Radio Button From Checkboxes Using Google Apps Script

00:15:01