haotu : an open lab notebook

2016/06/23

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.

2013/11/07

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

2012/05/16

Search text in pdf files that are images

Filed under: Google Docs — S @ 03:10

Google Docs will scan a pdf and extract the text, then you can search the text online in Google Docs. I use the Quickview option when I find a pdf in Google. This opens a Google Docs page and automatically extracts the text (it may take a small amount of time). Then you search and copy text in the document unlike in Adobe.

2012/03/23

How to use Endnote in Google Docs

Filed under: Google Docs, Reference Software — S @ 01:50

1. Have your document open.
2. Have endnote open.
3. Drag and drop citation to place in document wanted.
4. Export as doc and use Word.

see post here: (a href=”https://groups.google.com/a/googleproductforums.com/forum/#!category-topic/docs/docs-community/HqCcNsvHorg”>https://groups.google.com/a/googleproductforums.com/forum/#!category-topic/docs/docs-community/HqCcNsvHorg

Comment from post here:

Hi everyone,
Looking for a way to use Endnote and Google Docs I find out that is possible just drag references from endnote to google docs. It will appear in google doc unformatted {Adler, 2006 #578} I just did it with this reference. Once I get my paper done I export to Open Office or Word and use Endnote to format bibliography. I and my collaborators keep using the same Endnote library synchronized trough dropbox (www.dropbox.com). Obviously will be better if we have a plugin, So I hope this workaround helps.

Create a free website or blog at WordPress.com.