<file_sep>var url = "スプレッドシートの公開URL"
var book = SpreadsheetApp.openByUrl(url);

var date = new Date;
var nengatsu = Utilities.formatDate( date, 'JST', 'yyyy年M月');
var nowTime = Utilities.formatDate( date, 'JST', 'HH:mm:ss');
var nowDay = Utilities.formatDate( date, 'JST', 'dd');

var sheet = book.getSheetByName(nengatsu);
var todayCell = parseInt(nowDay, 10) + 6;

function test(){
  var e = { parameters:{ n : "gm", m : "gn" } }
  doGet(e);
}

function doGet(e){
  var message = e.parameters.m;
  return message == "gm" ? helloEveryone() : goodByeEveryone();
}

function helloEveryone(){ 
  var range = sheet.getRange("B"+ todayCell.toString());
  range.setValue(nowTime);
  
  return "GOOD MORNING FOR MY DREAM!!!";
}

function goodByeEveryone() {
  var range = sheet.getRange("C"+ todayCell.toString());
  range.setValue(nowTime);
  
  return "GOODBYE AND GOOD NIGHT!!!";
}
<file_sep>'use strict';

var app     = require('app');
var Tray    = require('tray');
var Menu    = require('menu');
var request = require('superagent');

require('crash-reporter').start();
var mainWindow = null;
app.dock.hide();
app.on('window-all-closed', function(){
  if (process.platform != 'darwin'){
    app.quit();
  }
});

var url = "スプレッドシートのスクリプトURL";
app.on('ready', function(){
  // Google Spreadsheetsへの操作
  var gss = {
    goodMorning : function(){
      postData("gm");
    },
    goodNight : function(){
      postData("gn");
    }
  }

  // 通知領域への操作
  var currentHighlight = false;
  var appIcon = new Tray(__dirname + '/images/icon.png');
  appIcon.setHighlightMode(currentHighlight);
  var contextMenu = Menu.buildFromTemplate([
    { label: '出勤', type: "normal", click: gss.goodMorning },
    { label: '退勤', type: "normal", click: gss.goodNight },
    { label: 'おわり', type: "normal", click: app.quit }
  ]);
  appIcon.setContextMenu(contextMenu);


var options = { timeout: 2000 };


function postData(word){
  request.get(url).query({ m: word }).end(function(err,res){
    if(!err && res.body){
      console.log("OK");
      appIcon.setImage(__dirname + '/images/icon2.png');
      setTimeout(function(){
        appIcon.setImage(__dirname + '/images/icon.png');
      },2000)
    } else {
      console.log("fuck");
    }
  });
}
});


