tag:blogger.com,1999:blog-24597839490895382982024-03-29T03:09:55.486-04:00Google Apps ScriptGoogle Apps Scripthttp://www.blogger.com/profile/10247158414228508999noreply@blogger.comBlogger40125tag:blogger.com,1999:blog-2459783949089538298.post-10482531612336543462011-06-20T21:44:00.006-04:002011-06-20T21:48:47.578-04:00Merging with Google Apps Developer Blog<div style="background-color: transparent; margin-top: 0px; margin-left: 0px; margin-bottom: 0px; margin-right: 0px; font-family: 'Times New Roman'; font-size: medium; "><span id="internal-source-marker_0.48139525833539665" style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Coming out of Google I/O, Google Apps Script has accelerated its momentum, introducing a lot of cool new features that have been top requests of our community. Over the last six months we’ve released </span><a href="http://code.google.com/googleapps/appsscript/service_document.html"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">Document Services</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">, </span><a href="http://code.google.com/googleapps/appsscript/service_gmail.html"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">Gmail Services</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">, a</span><a href="http://www.youtube.com/user/GoogleDocsCommunity#p/c/E630653EE5F67B37/1/pEb-93pDHWU"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; "> debugger</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> and a drag and drop </span><a href="http://code.google.com/googleapps/appsscript/guide_gui_builder.html"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">GUI Builder</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">. We’ve also invested in the Script Editor, improved UI Services and revamped Contacts Services. It’s also now easier to embed Apps Script in Google Sites and enhance Sites to an infinite possibilities. All this is in addition to vast improvements in performance, reliability and infrastructure upgrades that we think have made Google Apps Script a thriving part of Google Apps.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">To continue this momentum, we’re streamlining our communications by merging this blog into the </span><a href="http://googleappsdeveloper.blogspot.com/"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">Google Apps Developer Blog</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">. Integrating the two will help strengthen the community by reaching more of you, and it better reflects that Apps Script is a vital part of Google Apps. We’ve contributed several posts to the Google Apps Developer blog over the past few months and received a very warm response—and we’re looking forward to posting more there in the future. </span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">We hope you’re as excited as we are about the future of Google Apps Script. Please follow us at our new home, the </span><a href="http://googleappsdeveloper.blogspot.com/"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">Google Apps Developer Blog</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">. </span></div><div style="background-color: transparent; margin-top: 0px; margin-left: 0px; margin-bottom: 0px; margin-right: 0px; font-family: 'Times New Roman'; font-size: medium; "><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><br /></span></div><div style="background-color: transparent; margin-top: 0px; margin-left: 0px; margin-bottom: 0px; margin-right: 0px; font-family: 'Times New Roman'; font-size: medium; "><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><i>Posted by Saurabh Gupta, Google Apps Script team</i></span></div>Unknownnoreply@blogger.com14tag:blogger.com,1999:blog-2459783949089538298.post-71021233483805195912011-04-19T12:01:00.004-04:002011-04-19T12:15:34.970-04:00Apps Script @Boston GTUGWe will presenting Google Apps Script at the upcoming <a href="http://boston.gtugs.org/">Boston GTUG</a> meeting on Wednesday, April 20th at 6:30pm. If you are in the area then be sure to stop by and check out what Google Apps Script is all about.<br /><br />The details of the event are available <a href="http://boston.gtugs.org/news/april20thmeeting-googleappsscripting">here</a>.<br /><br /><i>Posted by Saurabh Gupta, Google Developer Relations</i>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-2459783949089538298.post-16889234116278793772011-04-06T15:51:00.002-04:002011-04-06T16:18:26.794-04:00Grading Made Easy using Apps ScriptRepost from <a href="http://googleappsdeveloper.blogspot.com/2011/04/grading-made-easy-using-apps-script.html">Google Apps Developer Blog</a>.<br /><br /><i>Editor's Note: Guest author Dave Abouav is a Google employee who is a part-time instructor for a night class in physics. He created Flubaroo as a 20% time project at Google based on his own teaching experiences.</i> <br /> <br />As an instructor for a night class in physics at De Anza Community College, I didn't have enough time to grade assignments. Because it was a survey course, multiple choice assignments seemed like a viable option. So I used Google Forms to collect homework assignments. But I needed a way to grade the collected submissions and perform some useful analysis. The idea for Flubaroo was born and is now ready to share with other teachers thanks to <a href="http://code.google.com/googleapps/appsscript/index.html">Google App Script</a>!<br /> <br /><a href="http://www.flubaroo.com/">Flubaroo</a> is designed as a simple grading solution for teachers using existing tools they're already comfortable with. It allows automated grading of quizzes and assignments administered via Google Forms. Beyond just grading, Flubaroo also provides analytics such as a histogram of grade distribution and identification of questions that many students missed. Flubaroo's most popular feature is its ability to email each student their grade, along with the answer key if desired.<br /> <br />Here are the key reasons I chose Google App Script to implement Flubaroo:<ol><li>I wanted to build a simple application which can be easily integrated with Spreadsheets without the need to compile and deploy code.</li><li>I liked its ability to integrate right into the spreadsheet as a menu, easily giving teachers access to all of Flubaroo's features. </li><li>Apps Script provided UI Services which allowed me to build UI applications very easily from within a browser. I did not have to install complex tools to create a UI. </li><li>Apps Script Services makes it very easy to integrate other Google APIs such as Google Charts API for the grade histogram.</li><li>A JavaScript syntax is easy to program and without the need to learn more complex languages like Java and Python.</li><li>App Script gave me the ability to easily share my grading technique with other teachers through the Apps Script Gallery. It is very easy for anyone to install the Flubaroo script in their Apps Script editor.</li></ol> <br />It was easy to get started with App Script, and the examples already provided in the <a href="http://code.google.com/googleapps/appsscript/guide.html">Apps Script Documentation</a> further helped me get it working quickly. Flubaroo is about 2300 lines of code. I used <a href="http://code.google.com/googleapps/appsscript/service_spreadsheet.html">Spreadsheet Services</a> to process and grade assignment submissions. I extensively used <a href="http://code.google.com/googleapps/appsscript/service_ui.html">Ui Services</a> to create the grading flow. In addition, Flubaroo makes use of the Google Chart API to create the grade distribution chart. Integration with Apps Script with Google Chart API was very easy. Below is an example of the types of charts I was able to generate using Apps Script's integration with Google Chart API.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8Jj0CbrrCVrODFvJgoHl6jzbEITeu_OVOH7MWXrUfzZaUSnQjq-OLJ8koYd4_24Nn-EICcE8PMcLgwQdxvS6ylxXhRIPDv5Dy1i_VnRWfiXrBcKaNxYDl_Ev4VDgWVnC5nRvEb_7rndU/s1600/image00.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 371px; height: 399px; border: 0px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8Jj0CbrrCVrODFvJgoHl6jzbEITeu_OVOH7MWXrUfzZaUSnQjq-OLJ8koYd4_24Nn-EICcE8PMcLgwQdxvS6ylxXhRIPDv5Dy1i_VnRWfiXrBcKaNxYDl_Ev4VDgWVnC5nRvEb_7rndU/s400/image00.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5590674023105941746" /></a> <br /> <br />One of the great features of Apps Script is the availability of <a href="http://code.google.com/googleapps/appsscript/guide_events.html">Triggers</a> and Events. Events helped me provide a menu to the users. I created an onOpen function which installed a menu on the spreadsheet every time the spreadsheet is opened by a user. This allows users a menu based access to the various functions in the script.<br /> <br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYIFu7gwhG9CjHnDhpG1wxAi98dSYq1YMJDKwRTi1G0HWnx9p0Ww1v5IvvoEKP6vvfNm3jRCZqPDOW6rvTBShKkBeyOttxlUBFvJQpjPxg4KhiPf_Wi7tPaxzQPbN2O5xUHTM0pEAYQgA/s1600/image01.png"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 252px; height: 147px; border: 0px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYIFu7gwhG9CjHnDhpG1wxAi98dSYq1YMJDKwRTi1G0HWnx9p0Ww1v5IvvoEKP6vvfNm3jRCZqPDOW6rvTBShKkBeyOttxlUBFvJQpjPxg4KhiPf_Wi7tPaxzQPbN2O5xUHTM0pEAYQgA/s400/image01.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5590674443236534482" /></a> <br /> <br />If you'd like to give it a try then please install the script from the Apps Script gallery. You can also visit <a href="http://www.flubaroo.com/">Flubaroo website</a> to go through a full tutorial of the script. Thanks to Apps Script, grading assignments is no longer a chore for me.<br /> <br /><p><span class="post-author">Posted by Dave Abouav, Googler</span></p><p><b>Want to weigh in on this topic? <a href="http://buzz.google.com/goog.appsecosystem.buzz">Discuss on Buzz</a></b></p>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-2459783949089538298.post-72203692558381338372011-04-01T10:46:00.004-04:002011-04-01T10:53:50.636-04:00Video Tutorial for Ui ServicesWe are continuously improving our <a href="http://code.google.com/googleapps/appsscript/guide.html">documentation</a> and <a href="http://code.google.com/googleapps/appsscript/articles.html">tutorials</a>. Recently, we created a video tutorial to teach the basics of Ui Services. In this tutorial, you will learn how to create your very first <a href="http://code.google.com/googleapps/appsscript/class_uiapp.html">UiApp</a>. Enjoy the video!<br /><br /><i>Posted by Saurabh Gupta, Google Developer Relations</i><br /><br /><iframe title="YouTube video player" width="425" height="349" src="http://www.youtube.com/embed/5VmEPo6Rkq4?rel=0" frameborder="0" allowfullscreen=""></iframe>Unknownnoreply@blogger.com17tag:blogger.com,1999:blog-2459783949089538298.post-64029307737058563202011-03-24T14:26:00.007-04:002011-03-24T14:39:09.671-04:00Webinar for Educators<p>Join us at an upcoming webinar to learn more about Google Apps Script. This webinar is a part of <a href="http://www.google.com/apps/intl/en/business/webinars.html">Google Apps for Education Professional Development webinar series</a>. The webinar will cover a high level overview of Google Apps Script with basic example demonstrations. If you have always been interested in Apps Script and wanted to know what it is all about then this webinar is a great opportunity. This webinar will be focused on educators and how Apps Script can help them.</p><br /><b>Date</b>: Tuesday, March 29, 2011<br /><b>Time</b>: 4:30pm PT<br /><b>Duration</b>: 1 hour<br /><b>Speaker</b>: Saurabh Gupta, Google Developer Relations<p><a href="https://google.webex.com/google/onstage/g.php?t=a&d=678810097">Register Now</a><a></a></p><p><i>Posted by Saurabh Gupta</i></p>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2459783949089538298.post-91843496334768399942011-03-22T17:28:00.004-04:002011-03-22T17:37:11.949-04:00Last Call for Google I/O: Google Apps Challenge<i>Repost from <a href="http://googleappsdeveloper.blogspot.com/2011/03/last-call-for-google-io-google-apps.html">Google Apps Developer Blog</a></i><br /><p>On March 8th, we <a href="http://googlecode.blogspot.com/2011/03/last-call-for-google-io.html">announced</a> the Last Call for Google I/O contest for a chance to win tickets to the event. The contest is currently underway -- with 5 challenges remaining. <br /><br /> The last challenge, starting on March 29th at 4:00 P.M. PDT, will be based on Google Apps and we’d encourage all eligible developers to participate. To be sure that you’re prepared for the challenge, we have indicated a prerequisite to read up on <a href="http://code.google.com/googleapps/appsscript/">Google Apps Script</a>.<br /><br /> For more information on the contest rules and timeline, please see the <a href="http://googlecode.blogspot.com/2011/03/last-call-for-google-io.html">Google Code Blog</a> and the <a href="https://sites.google.com/site/lastcallforio2011/Home">Contest Site</a>.<br /><br/><br /><i>Posted by Ryan Boyd, Google Apps Team</i>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2459783949089538298.post-37908944997624196232011-03-22T11:45:00.004-04:002011-03-31T12:37:21.322-04:00Build Applications in Sites using Apps Script<span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 13px; "><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 13px; "><i>Repost from <a href="http://googleenterprise.blogspot.com/2011/03/build-applications-in-sites-using-apps.html">Enterprise Developer Blog</a></i></span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 13px; "><br /></span></div>Google Sites makes it easy for organizations to create and manage their intranets or external web pages. By making content management available to non-technical users, information is managed by more people making it more relevant and up to date.<br /><br />But sometimes intranets have more complex needs such as:<br /><ul><li>Content varied based on an employee’s location<br /></li><li>Information in another system that needs to be presented in a site<br /></li><li>A project tracker with a custom workflow<br /></li><li>An issue tracker<br /></li><li>A team issue tracker<br /></li></ul>To support these needs, we are excited to announce further integration between Google Sites and Google Apps Scripts that allows custom applications to be built in your Google Sites. To get started, take a look at our <a href="http://code.google.com/googleapps/appsscript/articles/getting-started-with-sites.html">“hello world” tutorial</a> and our <a href="http://code.google.com/googleapps/appsscript/index.html">Apps Scripts help center</a>. To get a sense for what is possible, we also recommend <a href="http://code.google.com/googleapps/appsscript/articles/building-sites-app.html">our tutorial on how to build an entire time-tracking application</a>, right in your site.<br /><br /><span class="byline-author" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; color: rgb(102, 102, 102); ">Posted by Laurent Tu, Software Engineer</span></span>Unknownnoreply@blogger.com12tag:blogger.com,1999:blog-2459783949089538298.post-683178915742131192011-03-21T09:58:00.008-04:002011-03-21T10:27:23.755-04:00Demystifying Time Zones in Apps Script - Part 2In the <a href="http://googleappsscript.blogspot.com/2011/03/demystifying-time-zones-in-apps-script.html">last post</a>, we went over the basic concepts of time zones in Apps Script. In this post, we will cover a few facts and best practices regarding time zones.<br /><ul><br /><li>The browser’s time zone is used only once in the entire life of a script, as it is the default value for the script’s initial time zone.<br /></li><br /><li>Spreadsheets and scripts have their own time zone property. Formulas use the spreadsheet’s time zone while custom functions use the script’s time zone.<br /></li><br /><li>The time zone of a script can be fetched by executing Session.getTimezone().<br /></li><br /><li>A JavaScript Date is created using var date = new Date(). The newly created date objects inherits the time zone of the script.<br /></li><br /><li>Triggers use their script’s time zone by default. However, when a script’s time zone is modified, the associated triggers still maintain their original time zone. The only way to change time zone of a trigger is by recreating the trigger.<br /></li><br /><li>A Google Calendar has its own time zone. The Calendar service uses JavaScript Date objects for all methods that take a date as a parameter. Javascript Date objects have an associated time zone. This is utilized by the Calendar service to perform time zone conversions.<br /></li><br /><li>CalendarEvent.getStartDate() will return a Date object that has the script’s time zone (not the calendar’s time zone.)<br /></li><br /><li>The time zone of a user executing a script has no effect on the time zone of a script’s execution environment.<br /></li><br /><li>Using Utilities.formatDate() will help you convert Date objects to strings while performing time zone conversions. This method uses the specification used in <a href=" http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html ">Java’s Data Format</a>.<br /></li><br /><li><A href=" http://unicode.org/repos/cldr/trunk/docs/design/formatting/zone_log.html">Standard Time Zones</a> should be used when creating Google Calendars via the Calendar service.<br /></li><br /></ul><br />We hope that these tips help you gain better understanding of time zones in Apps Script. For further questions, check out the <a href="http://code.google.com/googleapps/appsscript/guide.html">documentation</a> and the <a href="http://www.google.com/support/forum/p/apps-script"/>forum</a>.<br /><br /><i>Posted by Saurabh Gupta, Google Developer Relations</i>Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-2459783949089538298.post-11019710608809001692011-03-17T11:31:00.007-04:002011-04-06T16:17:49.058-04:00Fun Scripting in Apps Script Hackathon @ NC State<div><i><b>Editor’s Note:</b> Guest Author Md. Ahsanur Rashid is a MS student in the department of Computer Science at North Carolina State University. He recently participated in Google Apps Script Hackathon.</i></div><div><br /></div>When Google Apps Script Hackathon arrived at NC State, I took up the opportunity to learn Google Apps Script. In school, one of the problems that every group of friends always face is finding the best time to meet somewhere and have fun. Of course, we can use Google Calendar but what we needed was a collaborative way to choose best time and location for all of us to meet. Without a script or some sort of automation this can get kind of crazy and especially in large group settings. Lots of phone calls, emails, endless pings, buzzes and knocks. But it does not need to be this way because we can use Google Apps Script. So, here is how we solved the problem by writing a Google Apps Script.<br /><br /><b>Step 1</b> - Every weekend, each friend on the list will be sent an email with a link where he/she can choose the desired time before a preset cutoff. To make the form more user friendly, we designed the form to allow users to choose from a list box rather than directly entering a value.<br /><pre><br />function sendReminder() {<br /> // get the sheet and last row data<br /> var sheet = SpreadsheetApp.getActiveSheet();<br /> var lastRow = sheet.getLastRow();<br /> for ( var i = 2; i <= lastRow; i++) {<br /> // get the email and name for each row of the form<br /> var userEmail = sheet.getRange(i, getColIndexByName("Email")).getValue();<br /> var userName = sheet.getRange(i, getColIndexByName("Name")).getValue();<br /> // send an email to the user<br /> MailApp.sendEmail(userEmail, "Please send us your best time!", <br /> "Hi" + userName +",\n\n" + "Please fill the form at ....",<br /> {name : "Best Time Chooser"});<br /> }<br />}<br /><br /></pre><br /><div><div><b>Step 2</b> - At the cutoff time, our script will process all the responses from all the friends. We configured an Apps Script trigger which will execute the getBestTime() function at the cutoff time on Sunday. The script reads the selected time preferences from the spreadsheet using Spreadsheet Service in Apps Script. The most popular response wins. In case of a tie, a default time (Sunday) is chosen.</div></div><div><br /></div><div><br /></div><div><div><b>Step 3</b> - After calculating the most popular time preference, the script uses Mail Services to send an email to each friend. All the friends are sent an email to let them know the chosen date. </div><div><br /></div><div>A very useful feature in Apps Script is debugging. And it could not have been easier to debug in Google Apps Script. We can use Logger.log(<some_variable>); to log the values and debug based on those. Using View->Logs inside the script editor we can see the log file.</some_variable></div><div><br /></div><div>To summarize, it was an interesting experience using Apps Script at Google Apps Script Hackathon. Google Apps Script is quite intuitive and great for automating manual tasks.</div><div><br /></div><div><i>Posted by Md. Ahsanur Rashid</i></div></div><div><br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2459783949089538298.post-23158484040761220642011-03-11T13:29:00.005-05:002011-03-11T16:14:08.689-05:00Demystifying Time Zones in Apps Script - Part 1<span class="Apple-style-span">Dealing across time zones is complicated not only in real life but also in software programming. In Apps Script, we have support multiple time zones while keeping it simple. When you are writing scripts, you may have to manage time zone conversions because each service you use may operate in its own time zone.<br /><br />In Apps Script, there are a few basic concepts when it comes to time zones.<br /><br /></span><ol><li><span class="Apple-style-span">A script has its own independent time zone property. It does not share the time zone with either a user’s browser or a spreadsheet. A script’s time zone can be modified using the <b>File > Properties</b> menu in the Script Editor.</span></li><span class="Apple-style-span"><br /></span><li><span class="Apple-style-span">A script executes in its own time zone context. Each script is guaranteed an execution environment that uses the script’s predefined time zone. For example, different scripts executing <code>var date = new Date();</code> may get different dates depending on the time zone of the respective script.</span></li></ol><div><span class="Apple-style-span">Stay tuned for part 2!</span></div><div><span class="Apple-style-span"><br /></span></div><div><i><span class="Apple-style-span">Saurabh Gupta, Google Developer Relations</span></i></div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2459783949089538298.post-22393942663225057272011-03-08T12:23:00.007-05:002011-04-06T16:18:26.818-04:00Improving Revevol’s Productivity with Google Apps Script<span class="Apple-style-span" ><i>Repost from <a href="http://googleenterprise.blogspot.com/2011/03/improving-revevols-productivity-with.html">Google Enterprise Blog</a></i><br /><br /><i><b>Editor’s Note</b>: Guest authors Lynn Jaber and Romain Vialard work at Revevol, the first international service provider dedicated to Google Apps. Each day, they imagine new ways to improve their business processes with Google technology!</i><br /><br /></span><div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"><span class="Apple-style-span" ><br /><img height="121px;" id="internal-source-marker_0.5202350306790322" src="https://lh6.googleusercontent.com/SqvTIUOCbPgRHARrv-fsXnrsec-Lq6m5ROzi9dEINqS3RACXI03gLcX0DxnnVZkO6b6hpvvG7Wb6rQUhSIyzyJ3dqkw_c7MPbo-qjYcY7MK2syrpHfs" width="100px;" /><img height="117px;" src="https://lh3.googleusercontent.com/YXyJrzNx3doSoa09ioJu_KAS2PVj5mmyqdZUka0mwNTl1SE77k3DCauwjudcaTTqkFl7yDEM2-0v5mkcZvY0aPhe5ZtSIq8Rba-hZ6DVX17mLwe-P0s" width="100px;" /></span></div><span class="Apple-style-span" ><br /><br />At Revevol, we train clients’ employees who have just migrated to Google Apps, to help them get the most out of their new system. The more Revevol grows, the more customer trainings we have to handle, so we need to quickly find available trainers depending on parameters like the training date, language, location of trainers and trainer skills.<br /><br /><a href="http://code.google.com/googleapps/appsscript/">Google Apps Script</a>, a cloud scripting language based on JavaScript, is wired into almost every Google product, so it’s a perfect solution for checking calendars and spreadsheets, and solving our scheduling problems. In the early days, we were using a simple Google Form. It was really easy to put together and simple to use, but one thing was missing: the form just collected data -- there was no way it could automatically take action based on information submitted. Someone had to manually process the information.<br /><br />This is where Apps Script came to the rescue -- with a little JavaScript code we could build an interactive form that we so badly needed. In a single day, Apps Script let us build a shiny new graphical user interface for our tool, which lets let us dynamically search for available trainers across all skill levels and categories.<br /><br />How did we do it? We recreated our form using <a href="http://code.google.com/googleapps/appsscript/service_ui.html">Ui Services</a> in Apps Script. We added a panel next to the form, to show the search results of trainers that match our queries. By using <a href="http://code.google.com/googleapps/appsscript/service_spreadsheet.html">Spreadsheet Services</a> in Apps Script, we could search and fetch data from a spreadsheet that serves as our database of trainers. We also added the ability to sort the search results of trainers by skill level and distance from the training location.<br /><br /><br /></span><div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"><span class="Apple-style-span" ><br /><img height="200" id="internal-source-marker_0.5202350306790322" src="https://lh5.googleusercontent.com/U9jOdw9z-4hmtWFio946eibmZaEBkKGS_NWwSlm2-b2LDllCuIF6qH2IM1mohfdK77DIN6uSuUZupNb6yJNId-1tQmHWhTcPnk7jck6zEOpyXlWDuvo" width="400" /></span></div><span class="Apple-style-span" ><br /><br /><br />Thanks to integration with <a href="http://code.google.com/googleapps/appsscript/service_maps.html">Google Maps Services</a> in Apps Script, we're even able to display a map to help our project managers find the closest trainer. Project managers can select more than one trainer from search results and each selected trainer will receive a calendar invitation. The first to respond “Yes” gets the training assignment. It was incredibly easy to build and deploy this application. In one click, we published it so anyone at Revevol can access the tool in their browsers. Apps Script helped us automate this tedious business process!<br /><br /><br /></span><div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"><span class="Apple-style-span" ><br /><img height="188" id="internal-source-marker_0.5202350306790322" src="https://lh6.googleusercontent.com/Pk74u4-_5t041ERqXLWSCkMngRz8kMc4ycOKPaa3-zswzwciQGE-W8MwRLpZbSFzlXLGvNTTykiMbgekfr2Axo8RU5BStjho43kH-OGiHtoE8eDGf-M" width="400" /></span></div><span class="Apple-style-span" ><br /></span><div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" ><br /><br /></span></div><span class="Apple-style-span" ><br /><br />Posted by Romain Vialard and Lynn Jaber, Revevol</span>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-2459783949089538298.post-1295214430499480532011-02-23T15:28:00.000-05:002011-02-23T15:28:31.489-05:00Apps Script's New Debugger, improved Contacts, and more...Last night we released a new version of Apps Script with a major new feature - the Apps Script Debugger. A debugger is a tool that helps you to understand what's happening as your code runs, and it can be a huge help in figuring out why your code isn't running the way you intended.<br />
<br />
At its most basic, the debugger lets you set a 'breakpoint', and then inspect the state of the script at that point. A breakpoint is a signal to Apps Script to stop running your code, and you can set a breakpoint on any line of code, just by clicking on the line number. <br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-_N4JJn6aP7c/TWUdYLXwnaI/AAAAAAAAAB0/GCNsz8mDHU4/s1600/EditorDebugger.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="321" src="http://2.bp.blogspot.com/-_N4JJn6aP7c/TWUdYLXwnaI/AAAAAAAAAB0/GCNsz8mDHU4/s640/EditorDebugger.png" width="640" /></a></div><br />
Then, simply run the script using the 'bug' toolbar icon instead of the usual 'play' button, and the script will run only as far as the first breakpoint. The debugger panel then allows you to inspect the state of all of the variables in the script. You can find a more <a href="http://code.google.com/googleapps/appsscript/guide_writing_scripts.html#UseDebugger">detailed introduction to the debugger</a> in the user guide.<br />
<br />
We have also made a major update to the <a href="http://code.google.com/googleapps/appsscript/service_contacts.html">Google Contacts Service</a>. Along with the numerous bug fixes you'll also see a performance increase and better memory utilization. The other significant change relates to how we handle 'lists' inside an individual contact - now you can correctly handle multiple email addresses, postal addresses, IM addresses, phone numbers, urls and even dates.<br />
<br />
Lastly, we have been listening to feedback, reading the forums, and watching the issue tracker very closely. We have addressed over 200 bugs and feature requests so far this year; a detailed list of visible changes is available in our <a href="http://code.google.com/googleapps/appsscript/release_notes.html">release notes</a>. All that to say that we truly value your feedback - thank you for helping us make Apps Script even better.<br />
<br />
<span class="byline-author">Posted by: Evin Levey, Google Apps Script Product Manager</span>Unknownnoreply@blogger.com11tag:blogger.com,1999:blog-2459783949089538298.post-33454780603277841582010-12-20T15:06:00.004-05:002010-12-20T15:13:49.674-05:00DocsList, Notifications and Performance<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; font-family: 'Times New Roman'; font-size: medium; "><span id="internal-source-marker_0.7134016377385706" style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Have you ever wondered how you can manage permissions of your Files and Folders (aka DocsList) in bulk using Apps Script? And at night, when you are about to go sleep, have you wondered if your script is failing? And you must have wished if your script could run a bit faster. If yes, then we have three really good pieces of news to share with you. </span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Today, we are enhancing features in DocsList Services, introducing Notification of failed events and increasing the performance of Apps Script when they use other Google services.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 12pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: bold; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Enhancements to DocsList Services</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><a href="http://code.google.com/googleapps/appsscript/service_docslist.html"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">DocsList Services</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> in Google Apps Script provides a powerful API to manage user’s documents list - this week we’re adding functionality to modify file and folder permissions. We’ve added methods to Add and Remove permissions for both editing and viewing. </span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Why is this important? Two very interesting uses of this functionality are:</span><ol><li style="list-style-type: decimal; font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; "><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Ability to automate changes to File permissions based on logic in your script.</span></li><li style="list-style-type: decimal; font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; "><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Ability to make file permission changes in bulk (since we needed to give a break to administrators!!). </span></li></ol><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">These new methods are very easy to implement as you only need to provide an array of Users or Email Addresses and you are done! For example:</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(170, 119, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">// Get all VIEWERS of a File or Folder</span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Folder myFolder </span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">= </span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">DocsList</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">getFolder</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">(</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">"myFolder"</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">);</span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">File myFile </span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">= </span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">myFolder</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">getFiles</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">()[</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(34, 136, 17); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">0</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">];</span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">User</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">[] </span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">fileViewers </span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">= </span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">myFile</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">getViewers</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">();</span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">myFile</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">addEditor</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">(</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">"myfriend@mydomain.com"</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">);</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(170, 119, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">myFile</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">addViewer</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">(</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">"myOtherFriend@mydomain.com"</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">);</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(170, 119, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> </span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(170, 119, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">// Similarly you can make permission changes in bulk</span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">myFolder</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">addEditors</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">(</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">fileViewers</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">);</span></p><p style="margin-left: 36pt; margin-top: 0pt; margin-bottom: 0pt; "><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">myFolder</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">addViewer</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">(</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">fileViewers</span><span style="font-size: 11pt; font-family: Verdana; color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">);</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; "></span></p><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 12pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: bold; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Notification of Failed Events</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Most of you love and use Triggers for periodic execution of your scripts. We have now gone a step further by allowing you to configure Notifications when your scripts fail. You can setup a periodic email notification which will aggregate failures events thrown by your scripts and email it back to you. This is a really cool feature which will let you sleep at night!. </span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 12pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: bold; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Increased Performance in accessing other Google Services</span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">The fun thing about Apps Script is that it is an easy way to integrate various Google services like Contacts, Calendar, DocsList and Sites. We have just made this integration a lot more fun. Performance in communicating to these various Google Services has been optimized so that your scripts that access these services can run faster. Services like DocsList can be executed up to 3x faster. A big thanks to the team for that!</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Saurabh Gupta, Developer Relations, Google Apps Script</span></div>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-2459783949089538298.post-2857586331972660522010-10-28T12:13:00.010-04:002010-10-28T16:23:24.054-04:00Google Apps Script and Recurring Calendar Events<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: normal; font-style: normal; vertical-align: baseline; white-space: pre-wrap; "><a href="http://code.google.com/googleapps/appsscript/"><span class="Apple-style-span">Apps Script</span></a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> has added support for recurring calendar events. Users can now write scripts that create, retrieve, update, and delete recurring events in calendars. We’ve also made the interface for this feature simple and easy to use. Let’s look at some examples.</span><br /><span class="Apple-style-span" style="font-family: 'Times New Roman'; "><span class="Apple-style-span" style="font-size: 11pt; background-color: transparent;"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span></span></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">The following code snippet creates a calendar event for all days that are Friday the 13th, so you can remember to avoid bad luck on those days.</span><br /><span class="Apple-style-span" style="font-family: 'Times New Roman'; "><span style="font-family: Verdana; color: rgb(119, 0, 136); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><br /></span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: small; color: rgb(119, 0, 136); white-space: pre-wrap; "><span class="Apple-style-span">var</span></span><span class="Apple-style-span"> </span></span></span><span style="color: rgb(0, 0, 255); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">calendar </span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">= </span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">CalendarApp</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">getCalendarsByName</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">"My Calendar</span></span></span><span style="color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">"</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">)[</span></span></span><span style="color: rgb(34, 136, 17); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">0</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">];</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: small;"></span></span></span><span class="Apple-style-span"><span style="color: rgb(119, 0, 136); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">var </span></span></span><span style="color: rgb(0, 0, 255); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">fridayTheThirteenth </span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">= </span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">CalendarApp</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">newRecurrence</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">();</span></span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: small;"></span></span></span></span><span class="Apple-style-span"><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">fridayTheThirteenth</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">addDateExclusion</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span></span><span style="color: rgb(119, 0, 136); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">new </span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">Date</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">())</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"> .</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">addDailyRule</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">()</span></span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"> .</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">onlyOnWeekday</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">CalendarApp</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">Weekday</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">FRIDAY</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">)</span></span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"> .</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">onlyOnMonthDay</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(34, 136, 17); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">13</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">);</span></span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small; "><span class="Apple-style-span" style="color: rgb(0, 0, 0); white-space: normal; font-size: 16px; "><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">calendar</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">createAllDayEventSeries</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">"Bad luck!"</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">, </span></span></span><span style="color: rgb(119, 0, 136); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">new </span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">Date</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(), </span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">fridayTheThirteenth</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small; "><span class="Apple-style-span">);</span></span></span></span><span class="Apple-style-span"><br /></span></span></span></span><span style="font-size: 13pt; font-family: Verdana; color: rgb(80, 0, 80); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> </span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">The next code snippet adds an event to your calendar to remind you of election day in the United States.</span><br /><span class="Apple-style-span" style="font-family: 'Times New Roman'; "><span style="font-family: Verdana; color: rgb(119, 0, 136); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><br /></span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: small; color: rgb(119, 0, 136); white-space: pre-wrap; "><span class="Apple-style-span">var</span></span><span class="Apple-style-span"> </span></span></span><span style="color: rgb(0, 0, 255); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">calendar </span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">= </span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">CalendarApp</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">getCalendarsByName</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">"My Calendar</span></span></span><span style="color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">"</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">)[</span></span></span><span style="color: rgb(34, 136, 17); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">0</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">];</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: small;"></span></span></span><span class="Apple-style-span"><span style="color: rgb(119, 0, 136); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">var </span></span></span><span style="color: rgb(0, 0, 255); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">usaElectionDay </span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">= </span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">CalendarApp</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">newRecurrence</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">();</span></span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: small;"></span></span></span></span><span class="Apple-style-span"><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">usaElectionDay</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">addDateExclusion</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(119, 0, 136); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">new </span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">Date</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">()</span></span></span></span><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">)</span></span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"></span></span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"> .</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">addYearlyRule</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">()</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"> .</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">interval</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(34, 136, 17); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">4</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">)</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"> .</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">onlyInMonth</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">CalendarApp</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">Month</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">NOVEMBER</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">)</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"> .</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">onlyOnWeekday</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">CalendarApp</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">Weekday</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">TUESDAY</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">)</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"> .</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">onlyOnMonthDays</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">([</span></span></span><span style="color: rgb(34, 136, 17); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">2</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">, </span></span></span><span style="color: rgb(34, 136, 17); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">3</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">, </span></span></span><span style="color: rgb(34, 136, 17); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">4, 5, 6, 7, 8</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">]);</span></span></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; "><span class="Apple-style-span"><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small; "><span class="Apple-style-span" style="color: rgb(0, 0, 0); white-space: normal; font-size: 16px; "><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">calendar</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">.</span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">createAllDayEventSeries</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(</span></span></span><span style="color: rgb(170, 34, 34); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">"Go vote!!!"</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">, </span></span></span><span style="color: rgb(119, 0, 136); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">new </span></span></span><span style="color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">Date</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">(), </span></span></span><span style="color: rgb(0, 68, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span">usaElectionDay</span></span></span><span style="color: rgb(102, 102, 102); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small; "><span class="Apple-style-span">);</span></span></span></span><span class="Apple-style-span"><br /></span></span></span></span><span class="Apple-style-span" style="font-family: 'Times New Roman'; "><span class="Apple-style-span" style="font-size: 11pt; background-color: transparent;"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span></span></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">The interface to interact with recurring events is very straight forward and powerful. We were able to easily select all days matching the parameters Friday the 13th, and also to match all Tuesdays in each occurrence of November having a date between 2 and 8, every four years. You can quickly and easily describe dates and times of recurring events you’re looking for. For more information, please check out the </span><span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: normal; font-style: normal; vertical-align: baseline; white-space: pre-wrap; "><a href="http://code.google.com/googleapps/appsscript/release_notes.html"><span><span><span><span><span class="Apple-style-span">release notes</span></span></span></span></span></a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> and </span><span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: normal; font-style: normal; vertical-align: baseline; white-space: pre-wrap; "><a href="http://code.google.com/googleapps/appsscript/service_calendar.html"><span class="Apple-style-span"><span><span><span class="Apple-style-span">updated documentation</span></span></span></span></a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span></div>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-2459783949089538298.post-22195867292458698942010-10-25T22:06:00.000-04:002010-10-25T22:06:03.527-04:00Collaborative Fun in Spreadsheets<div style="background-color: transparent; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span id="internal-source-marker_0.2912683754693717" style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: italic; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Editor’s Note:</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: italic; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> Zach is a co-founder at </span><a href="http://www.olark.com/"><span style="background-color: transparent; color: #114170; font-family: Arial; font-size: 13pt; font-style: italic; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Olark</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: italic; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">- a dead simple way to talk with customers on your website. But when he isn’t at work, he enjoys making and playing games, like this one he created at the Google Apps Script hackathon in Mountain View.</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Spreadsheets.</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">That word conjures up nightmarish questions for me. What’s our cash flow this month? Are there enough Foo widgets being made BarBaz factory? Endless columns, questionable assumptions, mistakes in your calculations... when will it all end?</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">But it doesn’t have to be that way! Besides being a powerful business tool, the grid layout in a spreadsheet makes a great game board, and what better way to explore the versatility of Google Apps Script than by writing a game with a few simple rules:</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><ul><li style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Players alternate turns</span></li>
</ul><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><ul><li style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Each turn you choose an unpainted square as the middle of your pattern, but the rest of your pattern can paint over your opponent.</span></li>
</ul><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><ul><li style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">When all the squares in the 8x8 grid are painted, whoever has the most painted their color wins!</span></li>
</ul><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">When working with a spreadsheet, whether it is to make a game or a business report, there are a few things to keep in mind:</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">First, you don’t know how the user had the spreadsheet set up before installing the script, so make sure you go through and set column width, colors, text, and any other properties you specifically want.</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Second, there are several ways your code can get called from the spreadsheet. I chose to have the user solely interact via a menu. You configure the menu by writing an </span><a href="http://code.google.com/googleapps/appsscript/guide_events.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">onOpen()</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> function; it will get called whenever the spreadsheet is opened. You can also set up triggers that call your code on a certain time interval, or when a cell is edited.</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lastly, think about where you’re going to store state for your script. I designed my game so it didn’t require any hidden state, but if you’re implementing Sudoku or Battleship you may need to be clever about where you store that information. Fortunately, there are several services in Apps Script you can call out to, including pretty much any webservice via the </span><a href="http://code.google.com/googleapps/appsscript/service_urlfetch.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">UrlFetch Services</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. </span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span></div><div style="text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><img height="334px;" src="https://lh6.googleusercontent.com/8HOuH2IcsqWqcz7f_NQqknFTuxFgxnHpea75VAGk_CuCrOmAn4a3KgjzJSDoGA2-RnEfIYA4DJL89c6QmQIxRB-T3LAZSeizTmiAXI1X-sYdbmXo0A" style="cursor: move;" width="468px;" /></div></div><div style="text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><div style="text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: Times; font-size: medium; white-space: normal;"><img height="334px;" src="https://lh6.googleusercontent.com/rLCdLF9xWDJmH-jJgkhLwy-nB3wjJaHFFTz5H8ujjMfg737_8sJOQ9mIUtYjAxgPmxLAUsXGJCR90khH2xtNST_MZ4ne4ONJTc-xivXBBhUWsgUumA" style="cursor: move;" width="468px;" /></span></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: Times; font-size: medium; white-space: normal;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">If you haven’t checked out Google Apps Script yet, you should. After looking at the documentation and sketching out the idea on paper, it took about 2 hours to write and debug this 120-line app (and honestly, I’m kind of a javascript n00b). If you’re looking for a starting point or just to have some fun with Spreadsheets, check out the code here: </span></span><span class="Apple-style-span" style="font-family: Times; font-size: medium; white-space: normal;"><span style="background-color: transparent; color: #114170; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;"><a href="http://code.google.com/p/paintwar/">http://code.google.com/p/paintwar/</a></span></span></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="byline-author">Posted by: Evin Levey, Google Apps Script Product Manager</span></div>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-2459783949089538298.post-76287930576079330422010-10-25T21:59:00.001-04:002010-10-25T22:02:12.737-04:00Apps Script Now in Google SitesLast week we announced Apps Script availability inside Google Sites - see the official announcement <a href="http://googleenterprise.blogspot.com/2010/10/automating-business-processes-in-google.html">here</a>.<br><br><br />
<br />
<span class="byline-author">Posted by: Evin Levey, Google Apps Script Product Manager</span>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2459783949089538298.post-87980262520796388882010-10-20T13:41:00.000-04:002010-10-20T13:41:44.351-04:00Apps Scripts for Scheduling Student Meetings<i></i><br />
<i><div style="background-color: transparent; font-style: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span id="internal-source-marker_0.4978102359455079" style="background-color: transparent; color: #333333; font-family: Georgia; font-size: 13pt; font-style: italic; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Editor's Note:</span><span style="background-color: transparent; color: #333333; font-family: Georgia; font-size: 13pt; font-style: italic; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> Aran Glancy is a </span><a href="http://www.google.com/educators/gta.html"><span style="background-color: transparent; color: #000099; font-family: Georgia; font-size: 13pt; font-style: italic; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Google Certified</span></a><span style="background-color: transparent; color: #333333; font-family: Georgia; font-size: 13pt; font-style: italic; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> high school math teacher at the Dalton School in New York City. He teaches ninth and eleventh grades, and works with other teachers both formally and informally on the use of technologies (including but not limited to Google Apps) in the classroom. </span><br />
<span style="background-color: transparent; color: #333333; font-family: Georgia; font-size: 13pt; font-style: italic; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span class="Apple-style-span" style="font-family: Verdana; font-size: large;"><span class="Apple-style-span" style="font-size: 17px; white-space: pre-wrap;"></span></span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">As a teacher at the Dalton School in New York City, one of my most important and enjoyable jobs (along with teaching my 9th and 11th grade math classes) is to meet with my students one-on-one in what my school calls </span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: italic; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Lab</span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">. Both students and teachers have free time programmed into their schedules specifically to hold these meetings. But since every one's schedule is different, finding a common time to meet is often difficult. This school year I am implementing a Google Apps Script I wrote to help with the scheduling process. </span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The paper sign-up sheets we used when I first started were functional, but very problematic. Last year, I had the idea to move my schedule to a Google Calendar. Dalton is adopting Google Apps, but we haven't yet released Calendar to the students. To work around this, I made my Lab Calendar public and put a link on my blog and on our course websites. That way, students could see my schedule anywhere they could find a computer. Finding a free meeting time was now easy.</span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><br />
</span></div><div style="background-color: transparent; font-style: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The problem, however, was actually scheduling the labs. Without Calendar as part of our Apps deployment I couldn't share the calendar with them, and even if I could I was concerned about students deleting each other’s labs to make room for their own! I decided to have students email me their lab requests, which I would then use to manually create the events. For the students, this system worked well, but I found myself spending a lot more time than I had anticipated creating events. I have on average 6 to 10 of these meetings a day. Even with the Quick Add feature, it was still a big time sink. </span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">The biggest problem, however, was that most of the email requests were happening in the evening and during the night. Most of the time I didn't get to these until the morning, so many requests sat in my inbox unprocessed--and not on the calendar--throughout the night! Students were signing up for meetings at times that looked free but had actually been booked by another student earlier in the evening. I couldn't process the emails fast enough to prevent the overbooking. </span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This summer, as I prepared for another year, a colleague suggested that Google Apps Script might be able to add events to a calendar directly from a spreadsheet. I was intrigued. A quick google search led me to some sample code which I copied and pasted into the newly discovered Script Editor. </span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I quickly found my way to the</span><a href="http://code.google.com/googleapps/appsscript/index.html"><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #000099; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Google Apps Script API</span></a><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">, and was immediately amazed at all of the services available. With the Calendar service and and the Mail service in particular, I realized I could use a Google Form as my lab sign-up sheet. Through a script, a student's event could automatically be added to my calendar without directly giving the student access to the calendar.</span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I started by creating a Form with fields for name, email, date, time, topic, duration, and other comments. In the corresponding spreadsheet, I started a script that added the event to my calendar. With my calendar stored as the variable </span><span style="background-color: transparent; color: #004499; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">cal,</span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> the command</span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> cal</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">createEvent</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">("</span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Lab with "+</span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">student_name+</span></span><span style="background-color: transparent; color: #cc0000; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">"</span></span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">re: "</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+</span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">topic</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">, </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">d1</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">, </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">d2</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">, </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">advancedArgs</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">);</span></span><br />
<span style="background-color: transparent; color: #666666; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">added an event with title (for example) "Lab with Johnny re: factoring," where </span><span style="background-color: transparent; color: #004499; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">d1</span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> and </span><span style="background-color: transparent; color: #004499; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">d2</span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> are the start and end times. </span><span style="background-color: transparent; color: #004499; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">advancedArgs</span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> is just a list previously defined with name-value pairs for the Description field and the Location field of the Google Calendar event. I left off the location, because it wasn't necessary for my purposes.</span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">What if there was already something scheduled during that time? The line</span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: #770088; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> var </span></span><span style="background-color: transparent; color: blue; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">events </span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">= </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">cal</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">getEvents</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">(</span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">d1</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">,</span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">d2</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">);</span></span><br />
<span style="background-color: transparent; color: #666666; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">stores any events that already exist during the scheduled event in an array. I then used an if statement to test for conflicts before I created the event:</span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: #770088; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> if</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">(</span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">events</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">length</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">==</span></span><span style="background-color: transparent; color: #228811; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">0</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">)</span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> {</span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span><span class="Apple-tab-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">cal</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">createEvent</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">("</span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">Lab with " + </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">student_name + </span></span><span style="background-color: transparent; color: #cc0000; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">"</span></span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">re: " </span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">topic</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">, </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">d1</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">, </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">d2</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">, </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">advancedArgs</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">);</span></span><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> </span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">}</span></span><br />
<span style="background-color: transparent; color: #666666; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">When scheduling the labs, it's important to know whether a lab was scheduled successfully, so I used the Mail service to send emails confirming the event or reporting any errors. Here is an example of an error email: </span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">MailApp</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">sendEmail</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">(</span></span><span style="background-color: transparent; color: blue; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">myemail</span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+", " </span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ </span></span><span style="background-color: transparent; color: #0b5394; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">student</span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">email</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">, </span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">"Lab with Mr. Glancy: CONFLICT"</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">, </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">student_name </span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ </span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">"\n\nSorry, but the lab you tried to schedule on " </span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">d1</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></span><span style="background-color: transparent; color: black; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">toString</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">() + </span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">" for " </span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ </span></span><span style="background-color: transparent; color: #004499; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">duration </span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">+ </span></span><span style="background-color: transparent; color: #aa2222; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">" minutes was not available. \n\nPlease look for another time, and try again. If you have any questions, please email me directly. \n\nThanks, \n\nMr. Glancy"</span></span><span style="background-color: transparent; color: #666666; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">);</span></span><br />
<span style="background-color: transparent; color: #666666; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Encouraged and excited, I started adding more features. I found last year that students would often put the wrong date on their lab requests. To deal with this, I added a test to make sure that the lab hadn't already happened by comparing the start date and time to the timestamp of their form entry. </span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I also didn't want them scheduling meetings too early or too late, so I checked to make sure that the start and end times were during the regular school day. Each test has a corresponding error email, and if the event passes all tests and is created, a confirmation email is sent to both the student and myself. The final step was to set the script to run when a form submit event took place.</span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br />
<span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">I added a link to the form on my blog and course website just in time for the first week of school. As of this writing, 4 days into the semester, I have had 51 lab requests--all of which have been either successfully added to the calendar or marked as conflicts or invalid. And I haven't done any of them by hand! Thanks Google Apps Scripts. I haven't released the actual sign up sheet I am using, however, I created a template in the Docs Template Gallery called</span><a href="https://docs.google.com/a/google.com/previewtemplate?id=0AqmO9_KUVK6odHZSLXpsNnhMQnhoTHQwZ25sM016V1E&mode=public"><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 13pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 13pt; font-style: normal; font-weight: bold; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Sample Calendar-Import Form</span></a><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 12pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="background-color: transparent; color: black; font-family: Verdana; font-size: 12pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">which contains a very similar script and has the same functionality. Next project: A customized gradebook!</span></div></i>Unknownnoreply@blogger.com12tag:blogger.com,1999:blog-2459783949089538298.post-69442197852993355962010-08-25T14:04:00.004-04:002010-08-25T14:12:05.620-04:00Google Apps Script Hackathon September 23rd in Mountain View, CA<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; font-family: 'Times New Roman'; font-size: medium; "><span id="internal-source-marker_0.019703927682712674" style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">If you weren't able to attend the Apps Script hackathon that we held in NYC in June, and you want to learn more about </span><a href="http://code.google.com/googleapps/appsscript"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">Google Apps Script</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> and meet the Apps Script team, here’s your chance! We will be holding an </span><a href="http://sites.google.com/site/appsscripthackathonmtv/"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">Apps Script hackathon</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> in Mountain View, CA on Thursday, September 23 from 2pm - 8pm.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">After we cover the basics of Apps Script, you can code along with us as we build a complete script, or you can bring your own ideas and get some help and guidance from the team. There will be food, power, and Apps Script experts available to help throughout the day. Just bring your laptop, ideas, enthusiasm, and basic knowledge of JavaScript. Check out out the </span><a href="http://sites.google.com/site/appsscripthackathonmtv/"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">details of the event</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> and be sure to </span><a href="http://sites.google.com/site/appsscripthackathonmtv/registration"><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 153); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap; ">RSVP</span></a><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> to let us know you’re coming!</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; font-family: 'Times New Roman'; font-size: medium; "><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "><br /></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; font-family: 'Times New Roman'; font-size: medium; "><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Posted by Jan Kleinert, Google Developer Relations</span></div>Jan Kleinerthttp://www.blogger.com/profile/00699475672395235553noreply@blogger.com10tag:blogger.com,1999:blog-2459783949089538298.post-43514649930257263242010-08-16T20:05:00.001-04:002010-08-31T08:51:59.207-04:00UiApp for All, Properties, Sites!<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; font-family: 'Times New Roman'; font-size: medium; "><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; background-color: transparent; color: rgb(0, 0, 0); font-family: 'Times New Roman'; white-space: normal; font-size: medium; "><span id="internal-source-marker_0.4951217481866479" style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">We've just finished pushing one of our most feature-rich releases ever! So much has been added and improved in this release that it's hard to fit it all in one blog post. I'll run through the highlights, but please make sure to check out the <a href="http://code.google.com/googleapps/appsscript/release_notes.html">Release Notes</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> for a complete list of changes in this release.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">The biggest news is that <a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fgoogleapps%2Fappsscript%2Fguide_user_interfaces.html">UiApp</a> </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">is now available to all users! </span><span class="Apple-style-span" style="font-family: Arial; font-size: 15px; white-space: pre-wrap; "><a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fgoogleapps%2Fappsscript%2Fguide_user_interfaces.html">UiApp</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> allows you to build user interfaces, giving scripts the ability to show a friendly interface, which is a necessity for less technical users. We’re very happy to make this formerly Premier feature available to everyone. For more information, see the <a href="http://code.google.com/googleapps/appsscript/guide_user_interfaces.html">UiApp</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> code samples and <a href="http://code.google.com/googleapps/appsscript/service_ui.html">reference documentation</a>.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Next, we've added <a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fgoogleapps%2Fappsscript%2Fclass_scriptproperties.html">ScriptProperties</a> </span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">and <a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fgoogleapps%2Fappsscript%2Fclass_userproperties.html">UserProperties</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">. These features allow scripts to store key:value data per user, or per script. </span><span class="Apple-style-span" style="font-family: Arial; font-size: 15px; white-space: pre-wrap; "><a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fgoogleapps%2Fappsscript%2Fclass_scriptproperties.html">ScriptProperties</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> are a great place to store passwords and other script-specific information. </span><span class="Apple-style-span" style="font-family: Arial; font-size: 15px; white-space: pre-wrap; "><a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fgoogleapps%2Fappsscript%2Fclass_userproperties.html">UserProperties</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> are useful for storing things like user preferences. For details on using these properties, check out the <a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fgoogleapps%2Fappsscript%2Fservice_properties.html">documentation</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">We've added some new functionality to Sites and cleaned up some inconsistencies and bugs. This has greatly simplified the API, while at the same time making it more powerful and flexible. Some of these improvements have required changes to the API, which is documented in the <a href="http://www.google.com/url?q=http%3A%2F%2Fcode.google.com%2Fgoogleapps%2Fappsscript%2Fservice_sites.html">SitesApp reference guide</a>.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Finally, we've updated the Apps Script editor with a bunch of convenient features. You can perform Find & Replace in the editor. Script revisions are now available, so that you can see a history of changes to your scripts. Lastly, we’ve added the ability to change the timezone of a script, something that we hope will make developers’ lives easier.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">The remaining items in this release are listed in the <a href="http://code.google.com/googleapps/appsscript/release_notes.html">Release Notes</a></span><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-weight: normal; font-style: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">. We're look forward to hearing your feedback about all the new changes, and would love to see what you do with the new features. Some large improvements and features are in our pipeline, so stay tuned!</span></div></span></span></div>Unknownnoreply@blogger.com5tag:blogger.com,1999:blog-2459783949089538298.post-5189799049663798162010-07-14T21:11:00.000-04:002010-07-14T21:11:21.132-04:00Moving Google Apps Script to Google CodeAfter a lot of work, we're very happy to announce that Google Apps Script is now being hosted on <a href="http://code.google.com/">Google Code</a>. This is the culmination of significant effort by several people over the course of a full year!<br />
<br />
What does this mean for you? Well, the biggest immediate impact is that our documentation, landing page, tutorials, etc, are all now found at a new location - <a href="http://code.google.com/googleapps/appsscript/">http://code.google.com/googleapps/appsscript/</a>. For those of you with bookmarks, fear not! - we've installed redirects from the old locations to the new.<br />
<br />
Along with a new hosting, we've got an improved landing page that features current news (from this blog), and video embeds - pretty much the norm for a code.google.com landing page.<br />
<br />
That's all well and good, but what does it really mean? While Apps Script has always been a well supported project, moving to Code Site means that we're now officially committing to a formal standard for testing, support, documentation, deprecation and release process:<br />
<ul><li>Testing: we have a comprehensive test suite, and we'll maintain our test certified status.<br />
<br />
</li>
<li>Support: we have dedicated support engineers who will respond to issues within the defined SLA (Service Level Agreement). You may already have met Jan and Vic on the support forum - if not, make sure you <a href="http://www.google.com/support/forum/p/apps-script/">stop by</a>!<br />
<br />
</li>
<li>Deprecation: we don't deprecate any portions of our APIs without three years advance notice. This policy excludes APIs marked as experimental, or any security mandated changes.<br />
<br />
</li>
<li>Release Process: we comply with all internal release control processes, and we publish <a href="http://code.google.com/googleapps/appsscript/release_notes.html">release notes</a> for every product release.<br />
</li></ul><div>If you've been using Apps Script for a while, you'll hopefully realize that we've been adopting these standards over the last year, with the addition of release notes and the move to Code Site being the final steps in the process.<br />
</div><br />
<div>We look forward to hearing your feedback on the changes, and welcome any suggestions for further improvements.</div><br />
<span class="byline-author">Posted by: Evin Levey, Google Apps Script Product Manager</span>Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-2459783949089538298.post-66424960312507834462010-07-13T15:10:00.004-04:002010-07-13T15:30:09.927-04:00Tips for Publishing to the Apps Script GalleryEvery week we're seeing great new scripts being submitted for inclusion in the Apps Script Gallery. We've noticed that there are a few common issues that tend to pop up often. Here are some tips for submitting scripts to help you get your script included in the gallery as quickly as possible.<br /><br /><span style="font-weight: bold;">Provide a complete, accurate description of what your script does and why it's useful.</span><br />When you save your script, be sure to include a detailed explanation of the purpose of your script in the Description field. Imagine you are posting a short ad for your script -- what would you say to explain it to another user?<br /><br /><span style="font-weight: bold;">If your script relies heavily on spreadsheet formatting, consider submitting a spreadsheet template instead.</span><br />If your script depends upon a spreadsheet being formatted in a particular way or covers a very specific use case, then submitting a <a href="http://docs.google.com/support/bin/answer.py?hl=en&answer=148817">spreadsheet template</a> that includes the script could be a better option. The Apps Script team has submitted some <a href="http://www.google.com/google-d-s/scripts/templates.html">examples</a> of spreadsheet templates that contain scripts.<br /><br /><span style="font-weight: bold;">Consider adding a custom menu to the spreadsheet to make it easier to run your script.</span><br />Adding a<a href="http://www.google.com/google-d-s/scripts/guide_chapter_05.html#CustomMenu"> custom menu</a> to the spreadsheet will make it easier for users to run your script, and will save them from having to launch the script editor each time they want to run the script. Not everyone is comfortable with scripts, so consider adding a menu to make it clear what they should do.<br /><br /><span style="font-weight: bold;">Don’t rely on sheet, row, or column indices within a spreadsheet.</span><br />Avoid explicitly using sheet, row, or column indices, and instead refer to the active sheet, active selection, or column headers. For example, avoid using <a href="http://www.google.com/google-d-s/scripts/class_spreadsheet.html#getSheets">getSheets()</a>[0], and instead use <a href="http://www.google.com/google-d-s/scripts/class_spreadsheet.html#getActiveSheet">getActiveSheet()</a>, since a user may want to have your script act upon a different sheet than the one returned by getSheets()[0].<br /><br />If you build upon another script from the gallery, please contact the original script’s author to give them the opportunity to add your changes. We’d like to avoid having many versions of the same script in the gallery.<br /><br />Keep publishing those scripts!<br /><br />Note: Currently, you can only <a href="http://www.google.com/google-d-s/scripts/guide_chapter_04.html#ShareScripts">publish scripts</a> from a Google Account, not from a Google Apps account. If you don’t have a Google Account, you can <a href="https://www.google.com/accounts/NewAccount">create one</a> now.<br /><br />Posted by: Jan Kleinert, Google Developer RelationsJan Kleinerthttp://www.blogger.com/profile/00699475672395235553noreply@blogger.com1tag:blogger.com,1999:blog-2459783949089538298.post-5931869127966950562010-07-05T08:00:00.002-04:002010-07-05T08:00:04.830-04:00Apps Script Hackathon RecapOn June 24th, we hosted our first Apps Script hackathon at Google's NYC office. During the course of the day, we walked through a script to <a href="http://www.google.com/google-d-s/scripts/helpdesk_tutorial.html">automate a help desk workflow</a>, invited members of the engineering and product teams up on stage to answer questions, and worked directly with attendees to help them with their scripts. At the end of the event, we enjoyed some great demos including a custom spreadsheet function written by the youngest developer at the hackathon - 9 years old!<div><br /></div><div>Thanks to everyone who attended and helped make the event a success. We're looking into holding another hackathon in the fall on the west coast, and we hope to see even more of you then. Stay tuned for more details!</div><div><br /></div><div>Posted by: Jan Kleinert, Google Developer Relations</div>Jan Kleinerthttp://www.blogger.com/profile/00699475672395235553noreply@blogger.com1tag:blogger.com,1999:blog-2459783949089538298.post-26518877768672814432010-06-21T17:41:00.000-04:002010-06-21T17:41:01.712-04:00Custom Reporting with Apps Script<i><b>Editor's Note:</b> Romain Vialard is a business school student working as a junior product manager at a very large Google Apps Customer. His role is to increase productivity and customer satisfaction through training and knowledge management with Google Apps. </i><br />
<br />
I work at a large enterprise that often deals with thousands of trouble tickets in a day, so we make great use of JIRA’s support and tracking products. We recently embarked on a quest to improve our reporting, which in turn makes managing our projects easier.<br />
<br />
Apps Script provides the ability to fetch any url, and easily parse the resulting html or xml document. We can now retrieve our trouble tickets, field by field and month by month to form the basis of our custom reports. <br />
<br />
And thanks to the time driven triggers the reports can be automatically generated every morning - waiting for us as we arrive at the office!<br />
<br />
We’ve posted ths script in the Apps Script Gallery, and it is also available in this <a href="https://spreadsheets.google.com/lv?key=0AnxR7WfXrj7adHFBQURDLXZna0JyamdIcUd2eHB0Qmc&hl=en">Spreadsheet Template</a><spreadsheet template="">. Take a look at the YouTube video below to see the script in action:<br />
<br />
</spreadsheet><br />
<div style="text-align: center;"><object height="385" width="480"><param name="movie" value="http://www.youtube.com/v/BswNLnBupyg&hl=en_US&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/BswNLnBupyg&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></div><br />
Posted by Romain Vialard, Google Apps Scripter!Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-2459783949089538298.post-61889647559547611192010-06-16T19:57:00.000-04:002010-06-16T19:57:51.724-04:00Private Member Variables in Javascript Objects<div class="p1"><span class="s1">The programming language of Google Apps Script is JavaScript (ECMAScript). JavaScript is a very flexible and forgiving language which suits us perfectly, and there's also a surprising amount of depth and power in the language. To help users get into some of the more useful power features we're starting a series of articles introducing some more advanced topics.</span></div><div class="p2"><span class="s1"></span></div><div class="p1"><span class="s1"><br />
</span></div><div class="p1"><span class="s1">Let's say we want to create an object that counts the number of occurrences of some event. To ensure correctness, we want to guarantee the counter can't be tampered with, like the odometer on your car. It needs to be "monotonically increasing". In other words, it starts at 0, only counts up, and never loses any previously counted events.</span></div><div class="p1"><span class="s1"><br />
</span></div><div class="p2"><span class="s1"></span></div><div class="p1"><span class="s1">Here's a sample implementation:</span></div><div class="p3"><span class="s1"></span></div><div class="p4"><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span></span></div><div class="p4"><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b> Counter </b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>= </b></span></span><span class="s3"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: magenta;"><b>function</b></span></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>() {</b></span></span><br />
<span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b></b></span></span><span class="s4"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;"><b><span class="Apple-style-span" style="color: black;"> </span>this</b></span></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>.</b></span></span><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>value </b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>= </b></span></span><span class="s5"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>0</b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>;<br />
};</b></span></span><br />
<span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b><br />
</b></span> </span><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b> Counter</b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>.</b></span></span><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>prototype </b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>= {</b></span> </span><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b> </b></span></span><br />
<span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b> get</b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>: </b></span></span><span class="s3"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: magenta;"><b>function</b></span></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>() {</b></span></span><br />
<span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b></b></span> </span><span class="s3"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b> </b><span class="Apple-style-span" style="color: magenta;"><b>return</b></span><b> </b></span></span><span class="s4"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;"><b>this</b></span></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>.</b></span></span><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>value</b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>;<br />
},</b></span></span></div><div class="p4"><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span></b></span><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b> increment</b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>: </b></span></span><span class="s3"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: magenta;"><b>function</b></span></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>() {</b></span></span></div><div class="p4"><span class="s4"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b> </b><span class="Apple-style-span" style="color: blue;"><b>this</b></span></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>.</b></span></span><span class="s2"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>value</b></span></span><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>++;<br />
}</b></span></span></div><div class="p4"><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b> };</b></span> </span></div><div class="p4"><span class="s1"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><br />
</span></span></div><div class="p2"><span class="s1"></span></div><div class="p1"><span class="s1">This defines a constructor called Counter which can be used to build new counter objects, initialized to a value of zero. To construct a new object, the user scripts </span><span class="s6"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>counter </b></span></span><span class="s7"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>= </b></span></span><span class="s8"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b><span class="Apple-style-span" style="color: magenta;">new</span> </b></span></span><span class="s6"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>Counter</b></span></span><span class="s7"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>()</b></span></span><span class="s1">.<span class="Apple-converted-space"> </span>The constructor has a prototype object, providing every counter object with the methods </span><span class="s6"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>counter.increment</b></span></span><span class="s7"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>()</b></span></span><span class="s1"> and </span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">counter.get</span></b></span><span class="s7"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">()</span></b></span><span class="s1">.<span class="Apple-converted-space"> </span>These methods count an event, and check the value of the counter, respectively.<span class="Apple-converted-space"> </span>However, there is nothing to stop the script from erroneously writing to </span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">counter.value</span></b></span><span class="s1">.<span class="Apple-converted-space"> </span>We would like to guarantee that the counter's value is monotonically increasing, but lines of code such as</span><span class="s9"> </span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">counter</span></b></span><span class="s7"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></b></span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">value</span></b></span><span class="s10"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b>--</b></span></span><span class="s1"> or </span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">counter</span></b></span><span class="s7"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></b></span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">value = 0</span></b></span><span class="s1"> roll the counter back, breaking our guarantee.</span></div><div class="p2"><span class="s1"></span></div><div class="p1"><span class="s1"><br />
</span></div><div class="p1"><span class="s1">Most programming languages have mechanisms to limit the visibility of variables. Object-oriented languages often feature a <span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: magenta;"><b>private</b></span></span> keyword, which limits a variable's visibility to the code within the class. Such a mechanism would be ideal here, ensuring that only the methods </span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">counter.increment</span></b></span><span class="s7"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">()</span></b></span><span class="s1"> and </span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">counter.get</span></b></span><span class="s7"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">()</span></b></span><span class="s1"> could access </span><span class="s6">value</span><span class="s1">.<span class="Apple-converted-space"> </span>Assuming that these two methods are correctly implemented, we can be sure that our counter can't get rolled back.</span></div><div class="p1"><span class="s1"><br />
</span></div><div class="p2"><span class="s1"></span></div><div class="p1"><span class="s1">Javascript has this private variable capability as well, despite not having an actual keyword for it. Let's examine the fellowing code:</span></div><div class="p1"><span class="s1"><br />
</span></div><div class="p2"><span class="s1"></span></div><div class="p5"><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> Counter </span></b></span><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">= </span></b></span><span class="s3"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: magenta;">function</span></span></b></span><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">() {</span></b></span></div><div class="p6"><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span></b></span><span class="s3"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> <span class="Apple-style-span" style="color: magenta;">var</span> </span></b></span><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;">value</span> </span></b></span><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">= </span></b></span><span class="s5"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">0</span></b></span><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">;</span></b></span></div><div class="p4"><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span></b></span><span class="s4"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> <span class="Apple-style-span" style="color: blue;">this</span></span></b></span><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></b></span><span class="s2"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">get </span></b></span><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">= </span></b></span><span class="s3"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: magenta;">function</span></span></b></span><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">() {</span></b></span></div><div class="p7"><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span></b></span><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> <span class="Apple-style-span" style="color: magenta;">return</span> </span></b></span><span class="s4"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;">value</span></span></b></span><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">;</span></b></span></div><div class="p4"><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> };</span></b></span></div><div class="p5"><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span></b></span><span class="s4"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> <span class="Apple-style-span" style="color: blue;">this</span></span></b></span><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></b></span><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">increment </span></b></span><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">= </span></b></span><span class="s3"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: magenta;">function</span></span></b></span><span class="s10"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">() {</span></b></span></div><div class="p4"><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"></span></b></span><span class="s4"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> <span class="Apple-style-span" style="color: blue;">value</span></span></b></span><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">++;</span></b></span></div><div class="p4"><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> };</span></b></span></div><div class="p4"><span class="s1"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"> };</span></b></span></div><div class="p8"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="s1"></span></span></b></div><div class="p1"><span class="s1"><br />
</span></div><div class="p1"><span class="s1">This constructor gives you objects that are indistinguishable from those built with the first constructor, except that </span><span class="s11"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;">value</span></span></b></span><span class="s1"> is private.<span class="Apple-converted-space"> </span>The variable </span><span class="s11"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;">value</span></span></b></span><span class="s1"> here is not the same variable as </span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">counter</span></b></span><span class="s7"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">.</span></b></span><span class="s6"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;">value</span></b></span><span class="s1"> used above. In fact, the latter is undefined for all objects built with this constructor.</span></div><div class="p1"><span class="s1"><br />
</span></div><div class="p2"><span class="s1"></span></div><div class="p1"><span class="s1">How does this work? Instead of making </span><span class="s11"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b><span class="Apple-style-span" style="color: blue;">value</span></b></span></span><span class="s1"> a member variable of the object, it is a local variable of the constructor function, by use of the </span><span class="s8">var</span><span class="s1"> keyword. The </span><span class="s6">get</span><span class="s1"> and </span><span class="s6">increment</span><span class="s1"> functions are the only functions that can see </span><span class="s11"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;">value</span></span></b></span><span class="s12"> </span><span class="s1">because they are defined within the same code block. Only code inside this block can see </span><span class="s11"><b><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><span class="Apple-style-span" style="color: blue;">value</span></span></b></span><span class="s1">; outside code does not have access to it. However, these methods are publicly visible by having been assigned to the </span><span class="s13"><span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"><b><span class="Apple-style-span" style="color: blue;">this</span></b></span></span><span class="s1"> object.</span></div><div class="p1"><span class="s1"><br />
</span></div><div class="p2"><span class="s1"></span></div><div class="p1"><span class="s1">Limiting visibility of variables is considered a good practice, because it rules out many buggy states of your program. Make sure to use this technique wherever possible.</span></div><br />
<span class="byline-author">Posted by: Jason Ganetsky, Software Engineer, Google Apps Script</span>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2459783949089538298.post-20869189180462791512010-06-14T13:57:00.002-04:002010-06-16T19:57:09.202-04:00Doing more with CalendarOur Google Calendar integration is one of our more popular services. It's easy to see why, since Google Calendar is such a powerful tool, but it also means that we get a lot of requests from users for new features that expose more of this power. That's why I'm excited to report that we've released a new version of <a href="http://www.google.com/google-d-s/scripts/service_calendar.html">CalendarApp</a> that addresses the most common requests.<br />
<br />
We've added functionality for:<br />
<ul><li>creating new calendars</li>
<li>deleting calendars</li>
<li>subscribing to other people's calendars (and unsubscribing too)</li>
<li>differentiating between calendars you own and calendars to which you subscribe</li>
<li>controlling a calendar's color, whether it is selected, and hiding or showing it in your calendar list</li>
</ul>We’ve also added new, more powerful, methods for retrieving events for a given day or a range of days.<br />
<br />
Some of the oft-requested features addressed in this release include:<br />
<ul><li>creating all day events</li>
<li>deleting events</li>
<li>managing pop-up, SMS, and email reminders</li>
<li>new methods for controlling who can edit your event and how it shows up on other people's calendars</li>
</ul>You can also retrieve more information about guests, including their full names (if they are in your contacts) and how many additional guests they plan to bring.<br />
<br />
My favorite new feature is the ability to add your own "tags" to events. These are key/value pairs that you can attach to events from scripts. They can't be accessed from within Google Calendar, but you can retrieve them later in another script. This is a great way to attach your own specific meta-data to events, and we are excited to see what you folks will do with it.<br />
<br />
<span class="byline-author">Posted by: Corey Goldfeder, Software Engineer, Google Apps Script</span>Unknownnoreply@blogger.com2