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
/** | |
* gas-github library sample codes. | |
* see https://github.com/soundTricker/gas-github | |
*/ | |
//Create new gist | |
function createOrUpdateGist(){ | |
//Create Gist API | |
var gistApi = Github.create(UserProperties.getProperty("githubApiKey")).gists(); |
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
var KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //developer key , get from https://code.google.com/apis/console/b/1/ | |
var FILE_ID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // drive file id | |
function convertDocuments2() { | |
var oauthConfig = UrlFetchApp.addOAuthService('drive'); | |
//Create oauth config for drive api | |
var scope = 'https://www.googleapis.com/auth/drive'; | |
oauthConfig.setConsumerKey('anonymous'); | |
oauthConfig.setConsumerSecret('anonymous'); |
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
var projectId = ScriptProperties.getProperty("projectId"); | |
function プロジェクトの取得() { | |
var list = BigQuery.Projects.list(); | |
Logger.log(list); | |
} |
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
function myFunction() { | |
var option = googleOAuth_(); | |
option.method = "post"; | |
option.contentType = 'application/json'; | |
option.payload = JSON.stringify({ | |
"query": | |
{ | |
"kinds": | |
[ |
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
# | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You 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 | |
# |
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
var KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //developer key , get on https://code.google.com/apis/console/ and set enable the Drive API. | |
/** | |
* Convert from Excel data to Spreadsheet | |
* @param {Blob} excelFile the excel blob data. | |
* @param {String} filename file name on uploading drive | |
* @return {Spreadsheet} spreadsheet instance. | |
**/ | |
function convert2Spreadsheet(excelFile, filename) { | |
var oauthConfig = UrlFetchApp.addOAuthService('drive'); |
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
{ | |
"timeZone": "Asia/Tokyo", | |
"dependencies": { | |
}, | |
"exceptionLogging": "STACKDRIVER", | |
"oauthScopes": [ | |
"https://www.googleapis.com/auth/gmail.addons.execute" | |
], | |
"gmail": { | |
"version": "TRUSTED_TESTER_V2", |
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
function translate(val) { | |
if (val.map) { | |
return val.map(translate); | |
} | |
return LanguageApp.translate(val, "en", "ja"); | |
} |
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
var apiKey = "Your API KEY"; | |
function myFunction() { | |
var option = googleOAuth_(); | |
option.method = "get"; | |
//Spreadsheet.getActive().getId()をそのまま使うと、エラーになるので一回DriveのFileにかえてからIDを取得 | |
var res = UrlFetchApp.fetch("https://www.googleapis.com/drive/v2/files/"+ DriveApp.getFileById(SpreadsheetApp.getActive().getId()).getId() +"/comments?key=" + apiKey , option); | |
var json = JSON.parse(res.getContentText()); | |
Logger.log(json) |
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
function myFunction() { | |
// シートを取得 | |
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("シート1"); | |
// プロジェクトID、Queryを取得 | |
var projectId = sheet.getRange("B1").getValue(); | |
var query = sheet.getRange("B2").getValue(); | |
// Queryパラメータを作成 |
NewerOlder