gasでslackに毎日の感染者数を送信してみた

使用したapiはこれ
https://portal.opendata.go.jp/apis

```javascript
function isBusinessDay(date) {
    if (date.getDay() == 0 || date.getDay() == 6) {
        return false;
    }
    var calJa = CalendarApp.getCalendarById('ja.japanese#holiday@group.v.calendar.google.com');
    if (calJa.getEventsForDay(date).length > 0) {
        return false;
    }
    return true;
}





function sendSlack(channel_name,slackText) {
    // これから取得するWebhook URLを設定
    var webHookUrl = "〇〇";

    var jsonData = {
        "channel": channel_name,
        "text": slackText,
        "link_names": 1,
        "username": "コロナBot" //通知する名前
    };

    var payload = JSON.stringify(jsonData);

    var options = {
        "method": "post",
        "contentType": "application/json",
        "payload": payload,
    };

    // リクエスト
    UrlFetchApp.fetch(webHookUrl, options);
}



function corona_get(url, key) {
    // リクエスト
    return UrlFetchApp.fetch(url + "?apikey=" + key);
}

function myWrite() {
    var response = corona_get("url〇〇", "api key〇〇");
    var to_json = JSON.parse(response.getContentText());
    to_json = to_json[to_json.length - 1];

    var date = new Date();
    //スクリプトに紐付いたスプレッドシートのアクティブなシートを読み込む
    var mySheet = SpreadsheetApp.getActiveSheet();
    //読み込んだシートの最終行を取得する
    var lastRow = mySheet.getLastRow();
    console.log(Utilities.formatDate(SpreadsheetApp.getActiveSheet().getRange(lastRow,1).getValue(), 'Asia/Tokyo', 'yyyy-MM-dd'));

    if(Utilities.formatDate(SpreadsheetApp.getActiveSheet().getRange(lastRow,1).getValue(), 'Asia/Tokyo', 'yyyy-MM-dd') == Utilities.formatDate(date, 'Asia/Tokyo', 'yyyy-MM-dd') || Utilities.formatDate(SpreadsheetApp.getActiveSheet().getRange(lastRow,1).getValue(), 'Asia/Tokyo', 'yyyy-MM-dd') == to_json["日付"]){
        return;
    }
    

    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,1).setValue(to_json["日付"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,2).setValue(to_json["検査件数"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,3).setValue(to_json["陽性人数"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,4).setValue(to_json["陽性累計"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,5).setValue(to_json["現在陽性者数"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,6).setValue(to_json["退院"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,7).setValue(to_json["退院済累計"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,8).setValue(to_json["退院判明"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,9).setValue(to_json["退院判明累計"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,10).setValue(to_json["死亡"]);
    SpreadsheetApp.getActiveSheet().getRange(lastRow + 1,11).setValue(to_json["リンク不明者"]);
}

function myFunction() {
    var date = new Date();
    if (isBusinessDay(date)) {
        var mySheet = SpreadsheetApp.getActiveSheet();

        var lastRow = mySheet.getLastRow();


        var slack_txt = "日付：" + Utilities.formatDate(SpreadsheetApp.getActiveSheet().getRange(lastRow,1).getValue(), 'Asia/Tokyo', 'yyyy-MM-dd') + "\n";
        slack_txt += "陽性人数：" + SpreadsheetApp.getActiveSheet().getRange(lastRow,3).getValue() + "人\n";
        slack_txt += "検査件数：" + SpreadsheetApp.getActiveSheet().getRange(lastRow,2).getValue() + "件\n";
        slack_txt += "死亡：" + SpreadsheetApp.getActiveSheet().getRange(lastRow,10).getValue() + "人\n";
        sendSlack("#社内通知", slack_txt);
    }
}
```