Thứ Tư, 3 tháng 9, 2014

Google apps scripts

Google apps script

作り方

Step1: Tools > Script editor. click Blank Project
Step2: 要らないコードを全部削除
Step3: do something
Step4: トリガーを設定
Resources -> All your triggers
Screen Shot 2014-09-03 at 16.43.21.png

例:毎月、kpi_sampe シートを作成する

copySheet.js
function addCopySheet()
{
    var frienger_kpi = SpreadsheetApp.openById("Your Spreadsheet ID");
    var kpi_sample = frienger_kpi.getSheetByName("コーピしたいシート名前");
    var new_month = kpi_sample.copyTo(frienger_kpi);
    var name = getMonth() + "月";
    new_month.setName(name);
}

function getMonth()
{
   var today = new Date();
   return today.getMonth() + 1;
} 

Không có nhận xét nào:

Đăng nhận xét