This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DRY_RUN = false; | |
function getEventsForTomorrow() { | |
const timeZone = Session.getScriptTimeZone(); | |
let tomorrow = new Date(); | |
tomorrow.setDate(tomorrow.getDate() + 1); // get date for tomorrow | |
const tomorrowStr = Utilities.formatDate(tomorrow, timeZone, 'yyyy-MM-dd'); | |
// Get the events | |
const calendars = CalendarApp.getAllCalendars(); // get all calendars that the user owns or is subscribed to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SHEET_NAME_CONFIG = 'config'; | |
/** | |
* スプレッドシートが開いたときのメニュー追加 | |
*/ | |
function onOpen() { | |
SpreadsheetApp.getUi() | |
.createMenu('カレンダーから転記') | |
.addItem('カレンダーからイベント取得', 'getFilteredCalendarEvents') | |
.addToUi(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SHEET_NAME_CONFIG = '01_設定'; // 設定シート名 | |
/** | |
* onFormSubmitを手動でも実行できるように、スプレッドシートにメニューとして設定 | |
*/ | |
function onOpen() { | |
SpreadsheetApp.getUi() | |
.createMenu('定員付き選択肢') | |
.addItem('選択肢設定(手動)', 'onFormSubmit') | |
.addToUi(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const YEARS_AFTER = 5; // 5年後 | |
function onOpen() { | |
DocumentApp.getUi() | |
.createMenu('期限入力') | |
.addItem('年挿入', 'enterYear') | |
.addToUi(); | |
} | |
function enterYear() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2022 Taro TSUKAGOSHI | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gmailの受信トレイにある未読メールの件数をGoogleチャットで通知する、Spreadsheet-boundのGoogle Apps Script。 | |
* 前提: | |
* スプレッドシートに以下のように2列が設定されていること: | |
* | ACCOUNT | WEBHOOK_URL | | |
* | -------------------- | --------------------------- | | |
* | my-account@gmail.com | (Googleチャットのwebhook URL) | | |
* スクリプトは、実行しているアカウントとmy-account@gmail.comが一致すれば、 | |
* その受信トレイにある未読メールの件数をWebhookを設定したチャットに投稿する。 | |
* my-account@gmail.comは当該チャットに参加している必要がある。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Parse the string of recipients returned by Gmail into raw email addresses. | |
* For example, if Gmail provides a recipient string in form of | |
* "George Washington <gwashington@potus.com>" | |
* this function will return | |
* "gwashington@potus.com" | |
* @param {string} gmailRecipients String of comma-separated recipients returned by GmailMessages.getTo(), .getCc(), or .getBcc() | |
* @returns The raw email addresses of gmailRecipients, without recipient name and angle brackets | |
*/ | |
function getRawEmail_(gmailRecipients) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 実行するGoogleアカウントのカレンダーに登録されている「日本の祝日」カレンダーのIDを参照する↓ | |
const CAL_ID_HOLIDAY_JA = 'en.japanese#holiday@group.v.calendar.google.com'; | |
// オフィスアワーの開始・終了時刻をHHmmss形式のstringで設定↓ | |
const OFFICE_HOURS = { start: '090000', end: '170000' }; | |
// エラーとなったときの再実行までの時間(ミリ秒)↓ | |
const RETRY_MILLISEC = 5 * 60 * 1000; | |
// officeHourCheckがエラーとなったときの再実行までの時間(ミリ秒)↓ | |
const RETRY_MILLISEC_OFFICE_HOUR_CHECK = 5 * 1000; | |
const TIMEZONE = Session.getScriptTimeZone(); | |
const UP_KEY_DATE = 'upDate'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global SpreadsheetApp, UrlFetchApp */ | |
/* exported fetchAkitaDeps */ | |
const TARGET_URL = 'https://www.pref.akita.lg.jp/pages/genre/organization'; // クロールするサイトのURL | |
const SHEET_NAME = 'List'; // データを挿入するシート名 | |
const INSERT_DATA_POS = { row: 4, col: 1 }; // データの挿入開始位置 | |
const INSERT_EDIT_TIME_POS = { row: 1, col: 4 }; // 最終更新日時の挿入位置 | |
const REGEXP_DEPT = RegExp('<h3 class\=\"c-category-panel-item__heading\"><a href\=\"(?<deptUrl>[^\"]+)\">(?<deptName>[^の]+)の関連ジャンル<\/a><\/h3>[ ]*?<ul class\=\"c-category-panel-item__body c-gallery-list c-gallery-list--2\">(?<sectSource>.*?)<\/ul>', 'g'); // 部局名、URLを検出 | |
const REGEXP_SECT = RegExp('<li class\=\"c-gallery-list__item\"><a href=\"(?<sectUrl>[^\"]+)\">(?<sectName>.*?)<\/a><\/li>', 'g'); // 課名、URLを検出 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const CONFIG = { | |
'sheetName': 'Choices', // Name of sheet | |
'cellFormUrl': { 'rowNum': 4, 'colNum': 2 }, // Row and column numbers of the cell that designates the URL of Google Form. | |
'rangeOffsetChoices': { 'rowNum': 6, 'colNum': 3 }, // Left- and upper-most cell of the range in which choices are listed. | |
'timestampItemTitle': '最終更新日時' // Title of the item in the target Google Form that denotes the timestamp of which the form was last updated. | |
}; | |
function onOpen() { | |
SpreadsheetApp.getUi() | |
.createMenu('Choice Editor') |
NewerOlder