Posts

Upload Files from Google Drive to Google Cloud Storage with Google Apps Script

Image
This tutorial describes how you can upload files and folders from your Google Drive to a bucket in Google Cloud Storage using Google Apps Script. You can even set up a time-based trigger, like a cron job, that watches a folder in your Google Drive and automatically upload new incoming files to Google Cloud Storage. The same technique can also be used to upload files from Google Drive to Firebase Storage. Create Google Cloud Storage Bucket To get started, go to console.cloud.google.com/projectcreate and create a new Google Cloud Project. Once the project has been added, go to console.cloud.google.com/storage/create-bucket and create a new bucket. Give your bucket a unique name and select the region where you want to store your data. If the files you are uploading are private and you don’t want to make them public anytime later, you may enable the “Enforce public access prevention on this bucket” option. Create Storage Service Account Next, go to IAM & Admin > Service ...

Formulas in Google Sheets Disappear When New Rows Are Added - The Solution

Image
An order form, created in Google Forms, requires customers to provide their full name, the item quantity and whether home delivery is required. The final bill amount is calculated with a simple formula in Google Sheets. // Item cost is $99 per unit. Delivery cost is $19. = IF ( ISNUMBER ( C2 ) , SUM ( C2 * 99 , IF ( D2 = "Yes" , 19 , 0 ) ) , ) The Google Sheet owner has entered the formula across all rows in the Total Amount column so that the value is automatically calculated when a new form response is submitted. The problem is that the formulas in Google Sheets are automatically deleted when new responses come in. That’s the default behavior and even if you protect the column range, the formulas in the cell will be erased on new rows. How to Prevent Formulas from Deleting There are several workarounds to this problem. Use an ARRAYFORMULA Instead of adding formulas inside individual cells of the column, add an Array Formula to the first row of the colu...

How to Use Google Docs as a Code Runner

Image
You have been using Google Docs to write documents and essays but did you know that the same editor can also be used to write and run JavaScript code? It is no replacement for a dedicated IDE like Visual Studio code but Google Docs can be used as a JavaScript playground to quickly run code snippets. Here’s a sample document written in Google Docs and the document body contains a JavaScript function that calculates the number of days left until the next Christmas. Go to the Code Runner menu, choose Run JavaScript and the output of the function will display in a popup. See demo Code Runner in Google Docs Internally, there’s a little Google Apps Script that is doing the magic. It reads the body of your Google Document as a text string and uses the eval() function of JavaScript to evaluate the text. /** * @OnlyCurrentDoc */ function codeRunner ( ) { const doc = DocumentApp . getActiveDocument ( ) ; const text = doc . getBody ( ) . getText ( ) ; const re...

How to Send Personalized Text Messages from Google Sheets

Image
The Document Studio add-on helps you automatically send text messages when a new Google Form is submitted or when new rows are added to Google Sheets. You can thus build workflows that send text reminders when the invoices are due. Or you can get notified instantly when people fill out your Google Forms. The SMS Workflow The text messages in Document Studio are sent through Twilio but the app can be integrated with any SMS service as long as the service offers an API for sending text messages programmatically. You may use TextMagic, SimplyTexting, Vonage, ClickSend, RingCentral, or any SMS service of your choice. For this example, we have a Google Sheet that contains the customer’s name, phone number, invoice number and the amount that is due. Column A of the Google Sheet, titled Send Reminder contains checkboxes and the SMS should be sent only for rows where this checkbox is selected. Format the Phone Numbers The phone numbers in Column D should conform to the E.164 inte...

How Teachers can Email Parents of Students from Google Forms

Image
A school provides email accounts for students that are enrolled in high school. The school has published a Google Form and any student can put their name in the form to request access to an email address. Parent’s consent is required though. When a child submits the request, an email confirmation is sent to the parent of the child for them to provide consent before the student’s email address can be created. Lookup Parent’s Data in Google Sheets The key here is that an email should be sent to the parent of the student. This data itself is not available in the Google Form but the school maintains a Google Sheet with the parent’s data and we’ll do a lookup to fetch the parent’s name and email address based on the student’s name. When the Google Form is submitted, a new row is added to the Google Sheet with the form response. We’ll add two new columns to the form response sheet that will lookup up the parent’s email address and name from the parent records sheet. It uses Array...

How to Make Personalized Place Cards with Guest Names

Image
Whether it is a wedding party or a business conference, those tent-shaped place cards are ideal for helping your guests find their seats at the event. This tutorial explains how you can create personalized place cards with the names of your guests and the table number to which they have been assigned. We’ll use Google Sheets to create the party seating plan, Google Slides to design the place card template and Document Studio to generate those place cards as PDF files in Google Drive. Let’s get started. Create Guest Seating Plan Create a new spreadsheet inside Google Sheets ( sheet.new ), enter the names from your guest list and assign a table number for each guest. Make sure that the two columns have a title as shown in the screenshot above. Also see: Create Business Cards from Google Sheets Create Place Card Template Create a new slide deck inside Google Slides ( slides.new ) or use this readymade template to quickly get started. Go to File > Page Setup and change t...

How to Calculate the Percentage Score in a Google Forms Quiz

Image
We have created a simple quiz in Google Forms that has 3 questions and each correct answer gives you 10 points. The maximum score that can be attained in the quiz in thus 30 points. When someone takes the quiz and submits the form, the responses are recorded in a Google Sheet that is set as the response destination for your Google Form. There’s something interesting here as well. If the associated form is a quiz, Google Sheets will automatically add an extra column in the response sheet titled “Score” and this column will be populated with the total marks obtained by respondent in the quiz. Convert Quiz Score to Percentage A teacher may want to calculate the percentage score obtained by students in the Quiz and assign grades accordingly. This can be easily done with the help of Array Formulas in Google Sheets but before we get there, let’s see how we can convert the quiz score (say, 20/30) into a percentage. Extract the Score Obtained There are at least three way to extr...