Skip to content

Instantly share code, notes, and snippets.

@sakadon
Last active November 4, 2015 17:36
Show Gist options
  • Save sakadon/39177b3bf27caee54f3b to your computer and use it in GitHub Desktop.
Save sakadon/39177b3bf27caee54f3b to your computer and use it in GitHub Desktop.
Google Spreadsheetsに内容を追記するshell script + Google apps scripts ref: http://qiita.com/sakadon/items/e56856dd7d3c5b93cde1
function doPost(e) {
var ss = SpreadsheetApp.openById("###_API_TOKEN_###");
var sheet = ss.getSheetByName("シート名");
//formデータを取り出して、配列に格納
var array = [e.parameters.timestamp[0],e.parameters.hostname[0],e.parameters.plan[0],e.parameters.uri[0]];
//一発で最終行に書込みする
sheet.appendRow(array);
}
nowdata='現在時刻'
hostname='ホスト名'
plan='プラン'
curl -F "timestamp=${nowdate}" -F "hostname=${hostname}" -F "plan=${plan}" -F "uri=https://${hostname}/${dirname}/" https://script.google.com/macros/s/###_API_TOKEN_####/exec > /dev/null
echo ">> Added for Google spreadsheet"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment