Posts

Showing posts from December, 2020

How to Move Files Uploads from Google Forms to a Specific Folder in Google Drive

Image
The File Upload feature of Google Forms lets you receive files from form respondents directly in your Google Drive. You may add the File Upload question in your Google Form to receive PDF assignments from students, résumé applications, portfolio images from contestants, and so on. When a respondent uploads a file through Google Forms, the file are stored in a fixed folder of your Google Drive. All files are uploaded in the same folder and, thus looking at the file in your Google Drive, it is difficult to determine which respondent has uploaded which set of files. We can however use Google Apps Script with Google Form triggers to instantly organize files in Google Drive as soon as they are uploaded by the form respondent. You can change the destination folder where files are stored or create custom folders based on the form response. Organiza File Uploads in Google Drive In the following example, we will create a parent folder in Google Drive to house all the uploaded files. Ea...

How to Send a File to Participants After they Submit your Google Form

Image
When someone fills out your Google Form, you may want to send a file or two to the form respondent. For instance: A school teacher can send a Word document containing a copy of the answers to students who have completed the quiz. A musician can send her latest composition as an MP3 file to users who have completed her website survey built with Google Forms. An author can email a preview copy of her upcoming book in PDF to fans who have subscribed to her newsletter. An online store may send their catalog PDF to customers who have placed orders through Google Forms. Demo - Send Files with Google Forms Open this Google Form , type your email address and hit the Submit button. Check your inbox and you should immediately find a PDF copy of our famous 101 useful websites collection. How to Attach Files to Form Emails The Email Notifications add-on for Google Forms lets you send customized emails to form respondents after a new entry is received. The same notification can al...

JavaScript Design Patterns

This article is a summary of the various design patterns in JavaScript that help us create clean, easier to maintain code without polluting the global namespace. Object Literal Design Pattern To avoid the possibility of collusion with other variables of the same name in the global namespace, take all your variables and functionn and make them part of an object with a unique name. var com = com || { } ; com . digitalinspiration = com . digitalinspiration || { } ; com . digitalinspiration . person = { _name : "Amit Agarwal" , _country : "" , setCountry : function ( country ) { this . _country = country ; } , printCountry : function ( ) { console . log ( this . _name + " lives in " + this . _country ) ; } , } ; com . digitalinspiration . person . setCountry ( "India" ) ; com . digitalinspiration . person . printCountry ( ) ; Module Design Pattern This pattern helps create private variables...

YouTube Email Alerts - Monitor Videos around your favorite Topics

Image
The Google Alerts service makes it easy for you to monitor brand mentions and your favorite topics on the Internet. Just specify one or more keywords and Google will send an email notification when new web pages matching your search keywords are found on the web. The YouTube Email Alerts service is similar to Google Alerts but instead of scanning the whole worldwide web, it limits the searches to videos uploaded on the YouTube website. It then sends automatic email notifications when new videos are uploaded on YouTube around your topics of interest. Here’s a sample email notification sent by the YouTube Alert system that, in this example, is configured to track new video uploads around three topics - Tesla Model Y, The Queen’s Gambit, and Minecraft tutorials. Setup YouTube Email Alerts Here’s a step by step guide on how to set up your own YouTube email alert system for monitoring videos around your topics of interest. Click here to make a copy of the YouTube alert script i...

How to Share User Properties between Google Apps Script Projects

The Properties Service of Google Apps Script is used by developers to store app configuration and user specific settings. The properties data is scoped to a specific user, or a specific project, and cannot be shared between different projects. The Email Form Notifications add-on also uses the Properties Service to store rules that are defined by the user. The rules created by User A are not accessible to User B. However, in some specific cases, we may want to give access to our store data to another user so they may build upon the existing configuration rather than having to build everything from scratch. The new import export option allows the user to export properties data as a plain text file that can be imported into the property store of another user. Access the Property Store On the server side (Google Script), we define two methods - one for exporting data as a JSON file and the other method for importing data from the property store of another user into our own. /* C...

Useful JavaScript Functions

The code snippets are from a JavaScript course on Udemy . Create a function that can be invoked only once. const once = ( fn , ... args ) => { let called = false ; return ( ) => { if ( called === false ) { called = true ; return fn ( ... args ) ; } return 'Cannot call again' ; } ; } ; const printName = ( text , time ) => console . log ( ` ${ text } at ${ time } ` ) ; const fn = once ( printName , 'Google' , new Date ( ) . toString ( ) ) ; console . log ( fn ( ) ) ; console . log ( fn ( ) ) ; Measure the time it takes for a JavaScript function to run. const getUserData = async ( user ) => { const response = await fetch ( ` https://api.github.com/users/ ${ user } ` ) ; const json = await response . json ( ) ; return json ; } ; const time = ( fn , ... args ) => { console . time ( 'time' ) ; const result = fn ( ... args ) ; co...