- Create tickets
Closed dropdown - Calculate time to close
Create dashboard
Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Apps Script APIs used
Apps Script methods used
Video Transcript
<div>00:00 We're going to create an automatic help desk ticketing closing system here. It's going to be very quick because we're going to create a Google Form .<br>00:08 We're going to create a closed picker. This is going to be an automatic thing we do through Apps Script . How to Send Google Forms Entries Automatically with Apps Script Automate Help Desk Ticket Closing Create Google Form Automatically
And then when we close our tickets, we're going to add a timestamp .<br>00:16 So that we have a timestamp from the form when we get the tickets, when they open, and a timestamp when they close.<br>00:23 That means we can create a dashboard that shows both how many open tickets are there, plus what is the average time to close.<br>00:30 So we can monitor this kind of number . So let's go to tools, create a new form, and just get a very simple ticket.<br>00:41 So, help, fill in this help, and we'll help you. Automate Help Desk Ticket Closing
You may have some other things you want to ask here, but we're just going to ask a basic short answer, or even paragraph of what's the issue.<br>01:00 You probably have some other things here, but let's publish this. Make sure it's published to anyone. Done. And we can fill this out as well.<br>01:13 And so we have our form responses. We're going to call this Tickets. So that's going to be the name of the sheet, and we'll add a few here.<br>01:31 Some issue, submit, Now let's look at that. We have this. Build A Business: PR Agency in a Google Sheet 2 Forms 1 Sheet
We'll actually change this to Unformatted Data .<br>01:43 We're going to add a column here of Closed and Closed Time. How do we add this? Here, uh, actually, drop down menu.<br>01:55 Well, let's go up to Extensions, Apps Script . We're going to need to do two things. We're going to need to write a function , and then we're going to need to trigger that function when the form is submitted.<br>02:07 So, what we're going to a function called setClosedDropDown. We'll have an event here. Getting Started Coding in Apps Script Automate Help Desk Ticket Closing 2 Forms 1 Sheet
We can shorten this to just e, so we don't have to type the word event all the time.<br>02:20 We get some very interesting information from this. We get the row that we're on. e. range .getRow. We have the sheet that we're on.<br>02:34 e. range .getSheet. And we're going to end up having to set sheet. getRange , the row, uh, but the column will be C, so 3. And we need to set data validation rule.<br>02:56 And a rule here. Well, what's going to be our rule? We need two things. We need a rule, and we need a drop-down.<br>03:08 Like, items. How To Create a Stop Watch in Google Sheets Move Row Based on Dropdown
So, spreadsheet , app, .newDataValidation, .requireValueInRange, and our range , we're going to go get that actually, over here.<br>03:28 We're going to create a new sheet called Settings, CloseStatus. So in case you want to add more things here, so maybe closed, closed, open or in progress, that kind of thing.<br>03:50 We'll have these options here. So let's go get those. Drop down status range equals spreadsheet app dot get active spreadsheet dot get sheet by name.<br>04:06 Our name is going to be settings dot get range is going to be A to colon A. Create a Public Sheet and Private Sheet: Using ImportRange() Getting Started Coding in Apps Script Activate A Certain Sheet When Opening a Spreadsheet MESSIEST SPREADSHEET MISTAKE
So anything in that A column but not the header and we're going to require value in range drop down status range and we want it to be true that it needs to be a Thank one of those options And we'll need to build this okay, so<br>04:39 What we're doing here is we're setting this closed drop down anytime. Checkbox or Dropdown?
We're on a row that row gets created When a Form is submitted.<br>04:49 So let's go create the trigger again Our two steps are we create the function and then second we create the trigger Let's go over to triggers on the left and then on the bottom right add trigger choose which function to run We'll use set closed drop down We'll have the from spreadsheet and the select <br>05:06 event type is on form submit We'll click save And now let's go submit another response One more, oh we do need to authorize before we actually get this triggered.<br>05:21 Let's click allow. Create New Worksheet When Google Form Submitted What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users Automatic Calculations 2 Forms 1 Sheet
And there this trigger should show up there. And so if we get any errors we'll see the error rate here.<br>05:35 So let's add another one. One more issue. Let's click submit. We'll go back to our tickets. And here one more issue we have a drop down menu here.<br>05:46 Now we can click closed. So our next automation is going to be if we click closed in the C column on tickets.<br>05:52 Put in a timestamp in D. So that we can compare these two timestamps A and D. So let's go back to our script.<br>06:03 And add another function . Function on tickets. Edit. Automate Help Desk Ticket Closing Quick Follow Up Email
This time, we're using a built-in function . Not an installable one. This is a very simple trigger .<br>06:19 This trigger will happen. We don't need to create the trigger ourselves. It'll be here automatically. We need a few things. Variable, we need to know what row we're on.<br>06:28 E. range .getRow. We need to know what column we're on. We need to know what sheet we're on. Spreadsheet Automation 101 Lesson 2: onEdit() Trigger What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users Automation is not Magic
And we can then say if sheet is equal to, we need two equal signs.<br>06:56 I think is tickets in all caps, ampersand, let's move this up a little bit so you can see it, now ampers, double ampersand means and, column equals three, we're in this set C column, we also need another value, variable value equals E dot value two equal signs, and value is equal to all caps close closed<br>07:31 , then what are we going to do? Equal, Equal, Not Equal, Not Equal - How to Tell if Two Cells are the Same or Not The Same Equal, Equal, Not Equal, Not Equal - How to Tell if Two Cells are the Same or Not The Same Email When Cell Changes
We're going to go to spreadsheet dot app dot get active spreadsheet dot get sheet by name, tickets.<br>07:44 Dot get range row, same row we're on, and in the fourth column, set value new date. This sets a timestamp , this new date.<br>08:00 And this will run when there's an edit, so let's check that that's correct. And if there's an error , we'll see over here in executions.<br>08:14 This is completed. Let's double check all this, logger.log row.<br>08:32 Maybe this sheet is not correct. What else do we need, huh? Value. Let's log those. Spreadsheet Automation 101 Lesson 2: onEdit() Trigger How To Create a Stop Watch in Google Sheets Timestamp When Done on Certain Sheet Auto Sort By Last Edited Date
And that should trigger it as well.<br>08:54 Let's go back to our executions and see what log shows up. Oh, it's just sheet. So I think we need to sheet.getName.<br>09:14 Now let's try it. So we'll go here, we'll submit another response. And more issues. Submit. We have our drop-down menu and we want to close it.<br>09:29 And we have a timestamp . Perfect. So now we can tell what is the close time. So in our, time to close in our sheet here.<br>09:39 Time to close. I'm going to write a function . How To Create a Stop Watch in Google Sheets Automate Help Desk Ticket Closing Log Every Time a Google Sheet is Opened
If C2 equals closed then we're going to take the closed time and minus the time, the original timestamp to get the difference.<br>10:03 And if not, we'll just have it blank. So let's form the format this to duration, I think. There we go.<br>10:16 So this is three minutes, seven minutes, this is five seconds. There you go. Uhm. We can change these to something like this.<br>10:29 We can also change this format here, but let's add this value when we set closed dropdown .
Sheet. getRange , row, and column 5, setValue .<br>10:51 Our value is going to be this formula , but we want to make sure that, uh, the 2s and 2s here, or whatever row we're on.<br>10:58 So we're going to actually change these to, to backticks. Create a backtick here, and a backtick here. And instead of 2, we'll use a little bit of interpolation. Dollar sign , and curly brackets.<br>11:12 This means every time we enter the number , it'll be whatever the row is from our variable up here. Move Cells to New Row with Formula Beginners Guide to Using Index, Row, and Column | Simply useful Google Sheets Formulas Get Values from Sheet for Custom Function in Apps Script
So now when we create a new help ticket, help me please submit, we have our formula already there.<br>11:40 So we can hit closed, get timestamp , and a duration. Again, this format of this duration can probably be fixed to some extent.<br>11:52 So I think it's probably best to just wrap this with text, and have hours, minutes, and seconds, but also part of perhaps maybe even days here.<br>12:07 If you have more than, need more than hours. So let's add this text to our function here. Text and, I think we only need one comma there. There we go.<br>12:23 So now let's add a few more. How To Create a Stop Watch in Google Sheets Automate Help Desk Ticket Closing
Submit tickets. Ticket one. Submit. Ticket two. Submit.<br>12:35 Go back and see we have, ah, zeros until we have close, but this will be fine. We have some open tickets.<br>12:47 Now we need to create a dashboard . We're just going to go through, we're not going to make this very easy, we're just going to go through some very simple formulas.<br>12:56 Open tickets. Say, total open tickets. Here. Average time to close. Okay, so here we need to figure out how many tickets are there that are not closed.<br>13:19 So we can do count if. And our criterion is that it's not closed. Automate Help Desk Ticket Closing Messy Sales Pipeline CLEANED UP
You can also do count filter .<br>13:36 I think we just actually want to say equals count all, b colon b will have an issue.<br>13:49 of tickets. And then we'll minus count if this is closed.<br>14:04 That gets us to perfect. That is our answer. But now, here's our average time to close.<br>14:17 How are we going to figure that out? Well, we can use the seam filter . Or we can create a filter .<br>14:25 We're going to filter our time to close. And our condition is that this is equal to closed. Let's take out the very first header row .<br>14:37 So E2 and C2.
And we're going to average all of those. And there's our average. Let's see if that is correct because it's 177. Let's bring this back to reality.<br>14:56 There, 349. Dashboard , and here's our average time to close. Perfect. So we've created a little bit of a dashboard to get our information.<br>15:07 We've created our ticketing system here, where we have an issue. We can add any number of columns here that we want to get information from the Google Form .<br>15:17 We have a timestamp when it's submitted. We have a closed drop-down menu that's added. Organize Your Data! - Build a Kanban Board / Trello Board How To Add Numbers in Google Sheets
And our close time is automatically added when we click closed.<br>15:28 Our dashboard shows total open tickets and average time to close. Pretty cool. Thanks for watching.</div> Automate Help Desk Ticket Closing