Google Apps Script (GAS) is a JavaScript cloud scripting language that lets you extend Google Apps and build web applications.

learn more… | top users | synonyms (1)

23
votes
6answers
37k views

Alternating colors for lines in Google docs spreadsheet

I have a shared Google spreadsheet where several users have already filled out parts. It would be useful to have alternately colored lines to facilitate correct placement of additional data. Is ...
15
votes
1answer
4k views

How to fix smilies in Gmail showing as “J”

Is there a way to fix smilies in received emails that looks like "J" in Gmail? Other mail clients (such as Outlook) changes ":)" to smile character in Wingdings font that is letter "J". Although, in ...
14
votes
5answers
16k views

Text to columns conversion in Google Spreadsheets

How do you do a text-to-columns conversion in Google Spreadsheets? For example, I have the following data string in one cell: 5,233,6,2,6,7,2,2,6,6 I want to break it apart by the comma separator ...
12
votes
4answers
3k views

Is there any way to script a Google Docs spreadsheet?

I have a really complex spreadsheet in Google Docs, and while it works, having the ability to script it a bit (à la VBA in Microsoft Office) would make it a lot cleaner. I heard that this is doable in ...
11
votes
6answers
9k views

How to pass a range into a custom function in Google Spreadsheets?

I want to create a function which takes in a range... something like: function myFunction(range) { var firstColumn = range.getColumn(); // loop over the range } A cell would reference it using: ...
9
votes
2answers
2k views

Cumulative Sum without Script

For this question, I've created a Google Apps Script function, that calculates the cumulative sum of a range. Martin Hawksey on Google+ made a comment about a more efficient way of calculating the ...
7
votes
3answers
17k views

How do I mail merge from Google Spreadsheet to a Google Document?

With Microsoft Excel and Microsoft Word, it is easy to merge rows from a spreadsheet into pages in a Word file. This was traditionally used to make paper mailings. How can I do the same with Google ...
6
votes
2answers
3k views

Pass range in Google Apps script custom function without using A1 notation

I'm new to Google Apps script and I would like to create a function for a spreadsheet that sums cell values when the cells meet certain criteria, such as the background color. Moreover, I'd like to ...
6
votes
2answers
289 views

Custom data transpose?

I have an export for a group that composed of student/mentors. Everyone in the group is both a student and a mentor. I need to transform the data to have mentors with assigned students rather than ...
6
votes
2answers
3k views

Colorize a cell in Google Spreadsheets based on cell data

I'd like to colorize a cell based on it's contents. 0 = red, 100 = green, and linearly interpolated between. function LinInt(x){ var ss = SpreadsheetApp.getActiveSheet(); var cell = ...
6
votes
3answers
774 views

Sorting data in Google Spreadsheet by cell entry

I have a Google Spreadsheet that lists various events. Students have entered their name next to events that they would like to sign up for. It looks like this: Each student may sign up for more ...
6
votes
2answers
7k views

How to Refresh a cell in Google Spreadsheet?

I have a column in Google Spreadsheet that calls an outside webservice using URLFetch in a Google Script. The cell uses two parameters in that cell's row. After a change occurs where those two ...
5
votes
3answers
2k views

Cell reference with colour formatting

Is it possible to reference a cell in Google Spreadsheets so that cell where it gets displayed also displays it using the same text and cell colour formatting? =A1 Will only reference dell's value. ...
5
votes
2answers
2k views

Can I use other font weights in Google Documents?

How can I use other font weights (such as Book 300 for Open Sans) in my documents? Adding Open Sans only allows me to use Normal 400, for example.
4
votes
1answer
1k views

Google Spreadsheet Sort Two Columns

So I've found the following answer in regards to auto-sorting by one column, which works great How can I make some data on a Google Spreadsheet auto-sorting? However, my use case requires the sorting ...
4
votes
3answers
15k views

How can I automatically set “last updated” cell in row Google Docs Spreadsheets?

How can I automatically set "last updated" cell in row Google Docs Spreadsheets ? I want to create a column where the cells' value will be automatically set to when that row was last amended. Is this ...
4
votes
2answers
687 views

How can I dynamically format the diagonal cells in Google Spreadsheet?

I want all of the diagonal cells (A1, B2, C3, D4, E5, etc) of a Sheet to be formatted as Black Background, White Foreground. Is there any way to do this for a Sheet that constantly increases in size? ...
4
votes
1answer
336 views

Pull Twitter Posts into Google Spreadsheets

I would like to set-up a Google Spreadsheet that automatically pulls Twitter search results into the cells. For instance, I'd like to search for "pizza" near "baltimore" and then have any pizza ...
4
votes
2answers
3k views

How do I implement a script that creates a unique ID for a Google form submission?

I need to create a unique ID upon submission of a form which will be used as a project number for tracking. The number needs to be unique but not based on rows or other changeable data because ...
4
votes
1answer
2k views

Creating a function that runs when a Google spreadsheet is opened

I want to create a function which runs automatically when the spreadsheet is opened. This function will make the selected cell the last cell without text in a certain column. Basically, I don't want ...
4
votes
1answer
4k views

Auto create and name new sheet in Google Spreadsheet

How can I automatically create and name new sheets in a google spreadsheet from a list of names, such as a student roll sheet? I would like each new sheet to be created when I add corresponding names ...
4
votes
0answers
172 views

GmailApp service for consumer Gmail accounts?

I successfully set up Gmail Snooze in my google apps accounts (for work) and I like it so much that I want to set it up for my personal email, too (@gmail.com). I followed all the same instructions, ...
3
votes
1answer
824 views

Sum a column except current cell

Is it possible to sum all values in a column EXCEPT the value in the current cell? That is, the cell that is to hold the result. With a normal SUM(E:E) command the result is #REF! with a Circular ...
3
votes
2answers
835 views

How do I automatically expand a =QUERY when receiving submissions from a Google Form?

The Query below 'works' on a line by line basis (when manually filled down), but it does not 'autofill' down when new data is added to the 'responses sheet'. The data being added to the 'responses ...
3
votes
2answers
1k views

How to avoid “invoked too many times per second” error

I made a Google Apps Script, but often I get this error: Script invoked too many times per second in this Google user account. This is the script: function papersControl(tipo, col, prev_cell, ...
3
votes
1answer
914 views

Why would this Google Spreadsheet onEdit script be so slow (2 secs to change cells, 3 secs to update)

I've put together a script for a spreadsheet based on what I have seen here and other sources that should provide a simple username and timestamp function. I have another spreadsheet that uses a very ...
3
votes
3answers
3k views

Google Spreadsheets: how to specify entire sheet as range?

The best workaround I have found so far is: worksheet_name!$A$1:$YY but ideally I would like to be able to simply write, e.g.: worksheet_name! So, does anyone know: is there a syntax for ...
3
votes
2answers
1k views

Iterated variable (i) for argument on range in Google Scripts API

for (i=0; i<numItems; i++) { var cell = sheet.getRange(12,i); cell.setFormula(i); } This simple formula should go to every place on the column 12 where there is data, and replace it ...
3
votes
2answers
4k views

More Efficient Filtering Script

I'm exactly one day into writing Google scripts. I've managed to write one that will filter data in a spreadsheet with 24 columns and, for now, about 900 rows. The problem is, it's slow. Any ...
3
votes
1answer
1k views

How to re-use Google Apps Scripts in new Google Spreadsheet

I'm having an issue. Whenever I create a new spreadsheet, I'm not able to add a script I've already created. The list for recent projects or scripts is always blank. Anyone have a resolution or do I ...
3
votes
2answers
4k views

How can I use Google's functions in a spreadsheet's script?

When I use a function such as =importXml("http://www.google.com", "//a/@href") in a Google Spreadsheet cell, it works just fine. However, when I try to use the same function in a script, it gives an ...
3
votes
1answer
1k views

How can you add a conditional statement to a =QUERY function

How can I add a conditional statement (similar to an if elseif in .php) to the query listed below so that is will return columns D and E from Sheet2 if column C in the responses sheet == 1st or ...
3
votes
1answer
380 views

How Can I Solve Error “Exceeded maximum execution time” in Google Spreadsheet?

I found a script which I really need (link) but it gives an error (Exceeded maximum execution time) generally. How can I solve this error? This is the script: function getTotalSum(cell) { var ...
3
votes
1answer
113 views

Individual time stamps for individual sheets in a Google Spreadsheet containing multiple sheets

I am using the New Google Sheets, and I have created a "Master Document" that contains a multitude of sheets, with each expressing different kinds of data. I want a "Last modified" time stamp to ...
3
votes
1answer
660 views

Export all sheets in a spreadsheet to csv in Google Apps

Is there a way to export all sheets in a google spreadsheet to csv as individual files ?
3
votes
1answer
585 views

How to export / import a Google Apps Script as a file into a new spreadsheet?

I fear this may have an obvious answer, but I've been knocking my head over this and can't find it! When creating a new spreadsheet, we can easily create a script within it. I like to call it a ...
3
votes
1answer
139 views

How can I take the HTML/data from a Google Document and restyle it with CSS?

I have a list in a Google Document that I would like to restlye with CSS. Unfortunately Google Docs no longer allows using CSS/HTML styling within the app itself. What would I need to do to get ...
3
votes
1answer
292 views

How to report which checkboxes were left unchecked on a Google Forms submission?

I have a Google form that stores its responses in a Google spreadsheet. It's set up so that whenever someone submits the form, I receive an email report of the responses. There are many places in the ...
3
votes
3answers
3k views

How can I make some data Autosort in a spreadsheet on edit?

I am working with a simple spreadsheet that has name/lastnames in it. I need for the spreadsheet to automatically sort the entry alphabetically by the last name (column B). I have used the following ...
3
votes
1answer
234 views

Google Spreadsheet text cell formatting question

I'm trying to create some sort of automated formatting for certain columns (except headers of course.) to take a string of numbers (and previous formatting; which should be stripped.) and format it as ...
3
votes
0answers
156 views

How can I create a Google Spreadsheet whose name and cells auto-complete with cells completed on another sheet?

I'm using Google Spreadsheets to manage projects, and I'm not familiar with scripts or macros (though I'd really like to learn how to use it, so if you have any good tutorials or tips, let me know). ...
3
votes
1answer
308 views

Can a Google Spreadsheet be recalculated if it's not manually opened?

We have some Google Spreadsheets that use the ImportHtml() to pull in some real messy tables. Then on on an alternate page we access the above data and pull it into a nice cleanly formatted table via ...
3
votes
0answers
95 views

Color entire row based on the status in Column L [duplicate]

How can I make my spreadsheet look like in the picture below? Starting row 5, I want to color the entire row based on the status in Column L.
3
votes
1answer
518 views

Looping through the range of cells to test the dates

I am trying to create a function to check the dates in 'Dt' sheet and return Match or Not Match. It works fine with when I display my answer in MsgBox, but when I try to do it in one of the ...
3
votes
0answers
868 views

Google Spreadsheets: add unique QR code field to a spreadsheet based on a form in google docs using Script Trigger

At the end of each row filled in, using a custom Google Form, I'm adding three more columns: Date of creation Unique ID QR code (it is a list of computers) Unique ID and QR code are unique. QR ...
3
votes
2answers
2k views

Parsing timestamp in Google spreadsheet with script

I have a spreadsheet with a form that timestamps every time the form is submitted. I'm writing a script to change the background color of the timestamped cell if it is more than 7 minutes after a ...
3
votes
0answers
391 views

How can I get the body of a Gmail message before the quoted text with GmailApp? [closed]

I'm programming a little Google App Script for which I need to get the real body of an e-mail (using gmail services). By real I mean the pure body of a particular message, without the text that ...
2
votes
2answers
2k views

Is it possible to pull my Company directory into Google sites intranet?

We use Google apps for enterprise, and I want to build an intranet, based on the Google sites intranet template In the Directory area, I want that the list will be updated from my contact/company ...
2
votes
3answers
91 views

Code invoked too many times

My goal is pretty simple: take the value in column U and check if it's within particular ranges. If it's 1–100, put a 1 in column A. If it's 101–200, put a 2 in column A. The problem is, I have almost ...
2
votes
2answers
148 views

Incrementing value read from spreadsheet exploding. 1 + 1 = 200 000 000 000

I read a value (in this case 7) from a Google Spreadsheet with a script, increase that value using source++ and write the increment back to the spreadsheet. I expect a series of 7, 8, 9, 10. ...