User Tools

Site Tools


Sidebar

Top
Seminar
Courses
Textbooks
Documents
Downloads (-2016)
Downloads (2016-)
Weblog
RSS aggregates
Discussions
Archives


EMBL BioImage Data Analysis

EuBIAS

NEUBIAS

—- Contact
CMCI Alumni
ALMF
EMBL Heidelberg
EMBL Intranet


Popularity Ranking


Timeline of @cmci_

cmci_ avatar

RT @WimJHH: EMBL Heidelberg workshop "Cryo-EM in Industry & Academia", 6-8 February 2019. Success stories, new technologies, industry chall…
About 6 hours, 6 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

@f_levet @BertrandVernay I made it.
About 6 hours, 56 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

RT @haesleinhuepf: One more session on #ImageJ short cuts: SHIFT+U opens the command tree. I didn't know this one. Thanks @BertrandVernay a…
About 7 hours, 8 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

@ManuelTHERY @martinjones78 @NEUBIAS_COST Slowly Manu
About 16 hours, 50 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

@laure_plantard I can’t track JY himself with Trackmate. Metaphysical contradiction.
About 18 hours, 41 mins ago by: Kota Miura (@cmci_)

cmci_ avatar

“2 chapters of my dissertation was only possible with Trackmate”
About 20 hours, 10 mins ago by: Kota Miura (@cmci_)
blogtng:blogtop
Algorithm FRAP Fiji ImageJ ImageJ Plugin ImageJ Plugin 3Dviewer Imaris Java Javascript Python R bias blog dokuwiki fiji google imagej java libraries matlab meetings neubias news papers python references software webadmin




CMCI weblog

google APPs script: transferring name list in google spread sheet to google contacts.

A bit for the convenience of organizing a course:

1. Student registration by google Forms

2. Using the automatically generated name, email address, units, sort each student to a class and store them in google contacts. google APPs script, javascripting

First part is more or less interactive, and second part code is as shown below.

//made on 100615 kota Miura
// for sorting student list in Google spread sheet (collected by forms), 
// storing contacts in google contacts and also associate with each class. 
//

function storeNamesInContacts() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  var studentDataRange = sheet.getRange("A2:L29");
  // For every row of student data, generate an student object.  
  var studentObjects = getRowsData(sheet, studentDataRange); //right hand side is a custom functon in the tutorial
  var thirdst = studentObjects[2];

  var gp1 = ContactsApp.findContactGroup("BasicCourse201006a");
  if (gp1 == null) {
    var gp1 = ContactsApp.createContactGroup("BasicCourse201006a");
  }
  var gp2 = ContactsApp.findContactGroup("BasicCourse201006b");
  if (gp2 == null) {
    var gp2 = ContactsApp.createContactGroup("BasicCourse201006b");  
  }    
  for (i=0; i<studentObjects.length; i++){
    if ((studentObjects[i].course == 1) || (studentObjects[i].course == 2)) { 
      nc = ContactsApp.createContact(FirstNameFrom(studentObjects[i].name), LastNameFrom(studentObjects[i].name), studentObjects[i].email);
      if (studentObjects[i].course == 1) nc.addToGroup(gp1);
      if (studentObjects[i].course == 2) nc.addToGroup(gp2); 
      stringtodisp = "name "+ nc.getFullName()+"\n email "+ nc.getEmailAddresses()[0] + " course =" + studentObjects[i].course;
      //Browser.msgBox(stringtodisp);     
     }
  }
}

function FirstNameFrom(fullname) {
  var key = "";
  var upperCase = false;
  for (var i = 0; i < fullname.length; ++i) {
    var letter = fullname[i];
    if (letter == " " && key.length > 0) {
      i = fullname.length;
    } else {
      key += letter;
    }
  }
  return key;
}

function LastNameFrom(fullname) {
  var key = "";
  var laststarts = false;
  for (var i = 0; i < fullname.length; ++i) {
    var letter = fullname[i];
    if (letter == " ") {
      laststarts = true;
    } else {
      if (laststarts ){
        key += letter;
      }
    }
  }
  return key;
}

At the bottom of above script, “Library” in the link below should be copied and pasted in the same file. http://www.google.com/google-d-s/scripts/reading_spreadsheet_data.html

entry generator

Weblog Archive

blogtng/blogtop.txt · Last modified: 2016/05/24 05:46 (external edit)