GASåå¼·ä¼ #1 éå¬ãã¾ãã
Docs使ã£ã¦ã人ãªãã°èª°ã§ãç¡æã§ä½¿ãã¦ã½ã³ã½ã³ä½¿ããã®ã«ãå
¨ç¶ä½¿ããã¦ãªãå¯åæ³ãªåã®Google Apps Scriptã®å
¥éåãã®åå¼·ä¼ããã¾ããã
åå è
ã¯ãã»ã¼ã¨ã³ã¸ãã¢ã®æ¹ã§Javaã ã£ããPHPã ã£ããã§ãè¥å¹²åãJS使ãã§ãããå
¨å¡ãGmailãApps(not for Business)使ç¨è
ã§ããããããã15åç¨ã®åå è
ä¸GASçµé¨è
ã¯3åã§ã»ã¼åãã¦ã®GASã¨ããæãã§ãããååã¯ç¥ã£ã¦ãããèå³ããããã©ã¾ã 触ãã¦ããªãããããªæã
åéå½åã¯å ¨ç¶åå å¸æå± ãªãã£ãã§ãããã¸ã¯ã¸ã¯å¢ãã¦ãã£ã³ã»ã«å¾ ã¡ã«ãªã£ãã®ã§ãããä¼å ´æä¾ããã ããCreativeHopeããã«æ¤ åããã¼ãã«ãªã©å¢ããã¦ããã£ã¦åå å¸æå ¨å¡ã®æ¹æ¥ã¦ããããããã«ãªãã¾ããããããã¨ããããã¾ããï¼CreativeHopeãã
å½æ¥ä½¿ã£ãè³æãã¢ããã¾ããããã¢ã§ã¯ãSitesé£æºãªã©ããããã£ãã®ã§ãããä½æ ãæ¨æ¥ã¯èª¿åãæªãåããªãã£ãã®ã§ã¹ãã¬ããã·ã¼ãã«ã¨ããdemoãè¡ãã¾ããããµã³ãã«ã¢ããªã®çºè¡¨ã@ikikkoããã«ãé¡ãããã®ã§ãããTwitterãããã¼ã¿åå¾ããããBackLogã«ãã¼ã¿ç»é²ãããããdemoã¯ç´ æ´ãããã£ãã§ãã
GASã¯ãã³ãã³ãä¸ã¤ä¸ã¤ã¯å°ç²ã§ãããªã便å©ã«ãªãã³ãã³ãã¯å°ãªãã§ããä»ã®ãµã¼ãã¹ã¨ã®çµã¿åãããã¢ã¤ãã¢ï¼ã¤ã§ä¸æ°ã«æ´»ç¨åº¦åããå¢ãã¾ãã
ãããã便å©Tipsè¦ã¤ãããã©ãã©ãã¢ãããã¦ãããã¨æãã¾ããèå³ããæ¹ã¯ãLingrã«GASé¨å±ããã®ã§ãåå ä¸ããã http://lingr.com/signup?letmein=GAS_ja
//--- æ¶è²»ç¨è¨ç® ----------------------------------------------------------------------------------------- function inctax(pay){ var res = pay * 1.05 return res } function extax(pay){ var res = pay / 1.05; return res } function onlytax(pay){ var res = pay * 0.05 return res } // é¸æã»ã«ã®åå¾ function get_sell_data() { var value = SpreadsheetApp.getActiveRange().getValues(); if (value != null){ Browser.msgBox(value); } } // ã¤ã³ãããããã¯ã¹ããã®ãã¼ã¿å ¥å function set_cell_data() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var get_val = Browser.inputBox("æ°åãå ¥åãã¦ãã ãã"); sheet.getRange("A1").setValue("Number entered:"); var b1Range = sheet.getRange("B1"); b1Range.setValue(get_val.getCell().getValue()); var valueToShow = b1Range.getValue() + 1; Browser.msgBox("å ¥åãããæ°åï¼ï¼ã¯: " + valueToShow); } // ã¡ãã¥ã¼ãã¼è¿½å ----------------------------------------------------------------- function addMenuBar(){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var menuEntries = [ {name: "Hello", functionName: "menuFunc1"}, {name: "SS Name", functionName: "menuFunc2"}, {name: "SS ID", functionName: "menuFunc3"}, {name: "set cell", functionName: "set_cell_data"}, {name: "get cell", functionName: "get_cell_data"} ]; ss.addMenu("ã«ã¹ã¿ã ", menuEntries); } function menuFunc1(){ Browser.msgBox("Hello world"); } function menuFunc2(){ var title = SpreadsheetApp.getActiveSpreadsheet().getName(); Browser.msgBox(title); } function menuFunc3(){ var id = SpreadsheetApp.getActiveSpreadsheet().getId(); Browser.msgBox(id); } function onOpen() { addMenuBar() } //--- ã«ã¬ã³ãã¼ã¿ã¤ãã«åå¾ ----------------------------------------------------------------------------------------- function get_calTitle() { var cal = CalendarApp.getAllOwnedCalendars(); var cal_name = cal[0].getName(); //Browser.msgBox(cal_name); var btn = Button.setText('this is button'); Browser.msgBox(btn); } //--- ã«ã¬ã³ãã¼ã«ã¤ãã³ã追å ----------------------------------------------------------------------------------------- function addEventToCal(){ // 0çªç®ã®ã«ã¬ã³ãã¼ã®åå¾ var cal = CalendarApp.getAllOwnedCalendars(); var cal_name = cal[0].getName(); Browser.msgBox(cal_name); // ã«ã¬ã³ãã¼ã®ã¿ã¤ã ã¾ã¼ã³ã®åå¾ var tz_name = cal[0].getTimeZone(); Browser.msgBox(tz_name); var one_cal = CalendarApp.getCalendarById(cal_name); Browser.msgBox(one_cal); //cal.createEvent("Busy", new Date("2010 08:00:00 JS"), new Date("July 21, 2010 09:00:00 JST"), {location:'Nap room'}); } //--- Sitesã«ãã¼ã¸è¿½å ----------------------------------------------------------------------------------------- SITE_URL = "https://sites.google.com/site/a2cgas/"; function newSite(ins_data){ var site = SitesApp.getSite('sites.google.com', 'a2c_gas'); var parentPage = site.getChildByName(TOPNAME + '/' + 'test page'); var add_pagename = '123456'; var webTitle = 'ãã¹ãç¨ã®ã¿ã¤ãã«'; var webPageBody = webPageTemplate(); var webPage = site.createWebPage(webTitle, add_pagename, webPageBody); webPage.setParent(parentPage); } function getSite(siteInfo){ return site_data }​
## ãã®ä»æ å ±