ããã«ã¡ã¯ããã«ã¡ã¯ï¼ï¼
Googleã¹ãã¬ããã·ã¼ã使ã£ã¦ã¾ããï¼
è¤æ°ã®äººããã©ã¦ã¶ä¸ã§åæã«é²è¦§ã»ç·¨éã§ããã¨ã¯ã»ã«ã§ãï¼
ããè¶
便å©ã§ãããã
(ãã¯ã¼ãã¤ã³ãã¿ãããªãã¤ã便å©ã§ããï¼)
æè¿ã¯ã¨ã¯ã»ã«ã®ä»£ããã«
ããããã¼ã åãã®æ
å ±å
±æãã¼ã«ã¨ãã¦ä½¿ã£ã¦ã人ãå¤ãããããªãã§ããããã
ããããããã°ããã
ãã°ç®¡çãªã¹ã.xls ãã°ç®¡çãªã¹ãææ°ç.xls ãã°ç®¡çãªã¹ã5æ12æ¥ver.xls ãã°ç®¡çãªã¹ãææ°çã®ã³ãã¼.xls
— ã¯ã¾ã¡ãï¼ (@Hamachiya2) 2010, 5æ 12
ãããªãã¨ã«ããªããªãã¦æ¸ã¿ã¾ããããããè¯ãã£ãï¼
ãããªGoogleã¹ãã¬ããã·ã¼ããªãã§ãããæ¬ ç¹ããã£ã¦â¦ã
å¤æ´å±¥æ´ãè¶
è¦ã¥ããï¼ï¼ ãã§ãããâ¦ã
ã·ã¼ããè¤æ°ãããããªãã®ã ã¨ãä¸ä½ã©ããå¤æ´ããã®ããâ¦â¦ã¨ãã£ãæãã§ãã
ããã§ãã¿ã¤ãã«ã«ããããã«ã
Googleã¹ãã¬ããã·ã¼ãã®å¤æ´å±¥æ´ãGoogleã¹ãã¬ããã·ã¼ãèªèº«ã«æ¸ãåºãä»çµã¿
ã¨ãããã®ãä½ã£ã¦ã¿ãã®ã§ã¡ã¢ãã¦ããã¾ããã
ãããªæãã§èª°ããä½ããå¤æ´ãããã³ã«ãå¤æ´å±¥æ´ç¨ã®ã·ã¼ãã«ãã°ãã©ãã©ãèªåçã«è¿½è¨ããã¦ããããã«ãªãã¾ãã
(ãããã)
ã¾ãã¯ä»»æã®ã¹ãã¬ããã·ã¼ãã«ãLogãã¨ããååã®æ°è¦ã·ã¼ããä½ãã¾ãã
ãã®ã·ã¼ãã«å¤æ´å±¥æ´ãæ¸ãåºããã¦ããã¾ãã
次ã«ãã¼ã«ã¡ãã¥ã¼ãããã¹ã¯ãªããã¨ãã£ã¿ããé¸ãã§
å
ããæ¸ãã¦ãã myFunction ãæ¶ãã¦ã
ããã«ä»¥ä¸ã®ã³ã¼ããã³ãããã¾ãã
function onMyEdit(e) { //Logä¿åç¨ã·ã¼ãã®åå var logSheetName = 'Log'; // ã¹ãã¬ããã·ã¼ã var ss = SpreadsheetApp.getActiveSpreadsheet(); // ã¹ãã¬ããã·ã¼ãå var ssName = ss.getName(); // é¸æã·ã¼ã var sheet = ss.getActiveSheet(); // é¸æã·ã¼ãå var sheetName = sheet.getName(); // Logã·ã¼ããªãä½ãããªã if (sheetName == logSheetName) { return; } // é¸æã»ã«ç¯å² var range = sheet.getActiveRange(); // ã»ã«ç¯å²ã®è¡çªå· var rowIndex = range.getRowIndex(); // ã»ã«ç¯å²ã®åçªå· var colIndex = range.getColumnIndex(); // getRange(å§ç¹è¡, å§ç¹å, åå¾ããè¡æ°, åå¾ããåæ°) var v = sheet.getRange(rowIndex, colIndex, 1, 1).getValue(); //å 容ã空ã if (v == '') { v = 'â»åé¤ããªï¼'; } //æ´æ°è æ å ±ã¯æ³äººåãGoogle Appsã®åä¸ãã¡ã¤ã³ã§ãªãã¨åå¾ã§ããªãããï¼ãµã¤ãã® @gmail.com ã ã¨ç¡çããï¼ //https://productforums.google.com/forum/#!topic/docs/5D23Os_NIAc //æ´æ°è ã®ã¡ã¼ã«ã¢ãã¬ã¹ var email = Session.getActiveUser().getEmail(); //ããããLogã·ã¼ãã«æ¸ã込㿠//Logä¿åç¨ã·ã¼ã var logSheet = ss.getSheetByName(logSheetName); //å¼æ°ã§æå®ããè¡ã®åã®è¡ã«1è¡è¿½å logSheet.insertRowBefore(1); //æ¥ä» logSheet.getRange(1, 1).setNumberFormat('yyyy/mm/dd(ddd)'); logSheet.getRange(1, 1).setValue(new Date()); //æå» logSheet.getRange(1, 2).setNumberFormat('h:mm:ss'); logSheet.getRange(1, 2).setValue(new Date()); //æ´æ°è logSheet.getRange(1, 3).setValue(email); //ã·ã¼ãå logSheet.getRange(1, 4).setValue(sheetName); //è¡çªå· logSheet.getRange(1, 5).setValue(rowIndex); //åçªå· logSheet.getRange(1, 6).setValue(colIndex); //å¤æ´ã»ã«ã®å 容(Stringãã©ã¼ãããã«ãã) logSheet.getRange(1, 7).setNumberFormat('@'); logSheet.getRange(1, 7).setValue(v); /* //Slackã«éç¥ããå ´å //tokenãåå¾(ãã¿ã³æ¼ã)â https://api.slack.com/web //channels:idåå¾(ãã¿ã³æ¼ã)â https://api.slack.com/methods/channels.list/test //å ã«æ´æ°éç¥ç¨ãã£ã³ãã«ãä½ã£ã¦ãããæ¹ãè¯ãããï¼ var token = 'ããã«token'; var channel = 'ããã«channelId'; var userName = 'Spreadsheets'; // Slackæ稿æã«ä½¿ããã好ããªåå //Slackã«éç¥ããããã¹ã var text = 'ã'+sheetName + 'ãã·ã¼ãå¤æ´: ' + email + ' [' + rowIndex + ',' + colIndex + '] ' + v; UrlFetchApp.fetch('https://slack.com/api/chat.postMessage', { method: 'post', payload: { token: token, channel: channel, username: userName, text: text } }); //å®è¡ãã©ã³ã¹ã¯ãªããã«ãå®è¡ã«å¤±æ: fetch ãå¼ã³åºã権éãããã¾ããã //ã¨åºãå ´åãã¡ãã¥ã¼ããå®è¡ãã¦æ¿èªãã¦ããå¿ è¦ããï¼ //ãã¡ãããã¯ãGoogle Apps for work ã§ãªãã¨ã ãããï¼ //https://code.google.com/p/google-apps-script-issues/issues/detail?id=677 */ }
ãã¡ã¤ã«âä¿åãã¦â¦
念ã®çºã«ä¸åº¦ãå®è¡ã¡ãã¥ã¼ããããonMyEditããé¸ãã§å®è¡ãã¦ããã¾ãããã
æå¾ã«ããªã¬ã¼ãè¨å®ãã¾ãã
ãªã½ã¼ã¹ã¡ãã¥ã¼ â ç¾å¨ã®ããã¸ã§ã¯ãã®ããªã¬ã¼ â onMyEdit
ã¤ãã³ãã«ãã¹ãã¬ããã·ã¼ããããããç·¨éæãã¨è¨å®ãã¦ä¿åãã¾ãã
ããã§ã§ããããã
å
ã®ã·ã¼ãã«ãã©ã£ã¦ãLog以å¤ã®ã·ã¼ãã«ä½ãæ¸ãã¦ã¿ã¾ãã
å¤æ´ç®æãã¡ããã¨Logã·ã¼ãã«èªåè¨é²ããã¦ããã°æåã§ãã
å·¦ãããæ¥ä»ãæå»ãæ´æ°è
ãã·ã¼ãåãè¡ãåãå¤æ´å¾ã®å
容ã«ãªã£ã¦ãã¾ãã
誰ããã·ã¼ããç·¨éãããã³ã«ãã©ãã©ãå¤æ´ãã°ã(ä¸ã«)追è¨ããã¦ããã¾ãã
ãããã¾ããããªããã°ãã¹ã¯ãªããã¨ãã£ã¿ã®è¡¨ç¤ºã¡ãã¥ã¼ãã
ãå®è¡ãã©ã³ã¹ã¯ãªããããé¸ã¹ã°ã¨ã©ã¼ãªã©ã表示ããã¦ããã¯ããªã®ã§ãããã°ã£ã¦ãã ãããã
ãã ãããã«ã¯ä¸ã¤æ¬ ç¹ããã£ã¦ãæ³äººåãGoogle Apps以å¤ã®äººã
ã¤ã¾ãæ®éã®ã@gmail.comãã®ã¦ã¼ã¶ã¼ã®å ´åã¯ã
ã»ãã¥ãªãã£ä¸ã®é½åã®ããããæ´æ°è
ã®ã¡ã¼ã«ã¢ãã¬ã¹ã ãã¯åå¾ã§ããªãããã§ãã
ãã¨ããã¾ãã¨ãã¦ã¹ãã¬ããã·ã¼ããæ´æ°ããããã³ã«Slackã«éç¥ããä»çµã¿ãã³ã¼ãã«å
¥ãã¦ããã¾ããã
試ãã¦ã¿ãã人ã¯ãã³ã¡ã³ãé¨åãä¿®æ£ãã¦ã¿ã¦ãã ãããã
â»ãã ããã¡ãããæ³äººåãã®Googleã¢ã«ã¦ã³ãã§ãªãã¨ãã¾ãåããªãããã§ãã