haotu : an open lab notebook


replace empty cells in google sheets

Filed under: Google, Sheets, Uncategorized — S @ 10:35


Add timestamp to Google Sheets when data are entered

Filed under: Google, Google Docs, Sheets — Tags: , , — S @ 07:03

I wanted a time/date stamp for when a particular cell was populated with data.

First you will need to open the Script editor under Tools. Then paste and edit the below code.


function onEdit(event) { 
 var timezone = "GMT-4"; 
 var timestamp_format = "MM-dd-yyyy HH:mm"; // Timestamp Format. 
 var updateColName = "value"; // Column where data are populated
 var timeStampColName = "Timestamp"; // Column where timestamp is automatically populated
 var sheet = event.source.getSheetByName("data"); //Name of the sheet where you want to run this script. 
 var actRng = event.source.getActiveRange(); 
 var editColumn = actRng.getColumn(); 
 var index = actRng.getRowIndex(); 
 var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues(); 
 var dateCol = headers[0].indexOf(timeStampColName); 
 var updateCol = headers[0].indexOf(updateColName); updateCol = updateCol+1; 
 if (dateCol > -1 && index > 1 && editColumn == updateCol) { // only timestamp if 'Timestamp' header exists, but not in the header row itself! 
 var cell = sheet.getRange(index, dateCol + 1); 
 var date = Utilities.formatDate(new Date(), timezone, timestamp_format); 
 cell.setValue(date); } 

See here for original code as well as a video

Note that if you run the script (hit Play button) in the script editor you will get an error on line 6 simply because the “event” cannot be called in the editor. The code should still work fine.


Where to paste google analytics script when using a wordpress theme

Filed under: Analytics, Google, HTML — S @ 05:43

I used the insert headers and footers plugin and pasted my unique script in the header box once this plugin was installed on my site.

The WordPress theme I am using is tiny forge

Google Chart Tools in R

Filed under: Google, Google Docs, Manipulate Data in R, R, R, R graphics — S @ 03:21

There is a nice R package googleVis that integrates google motion charts and chart tools with R

A tutorial here


chrome.exe still running after close :: chrome.exe is caused by cloud print

Filed under: Chrome, Cloud Print, Google, Windows 7 — S @ 03:22

I have found that even if I do not allow extensions in Chrome to run in the background (i.e., in advanced settings), that an instance of chrome.exe is still running as a process once I exit Chrome.

This instance for me was caused by Google Cloud Print. Once I removed my cloud printers, the instance went away.

Create a free website or blog at WordPress.com.