Last active
June 7, 2019 19:15
-
-
Save baobao/fb4cf2fc99fc5ea47f1076c57d2f6943 to your computer and use it in GitHub Desktop.
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 sheetId = '拾ってきたいシートIDをいれる'; | |
var shtteName = 'シート1的なシート名' | |
function getData(id, sheetName) | |
{ | |
return SpreadsheetApp.openById(id) | |
.getSheetByName(sheetName) | |
.getDataRange() | |
.getValues(); | |
} | |
function doGet() | |
{ | |
var data = getData(sheetId, shtteName); | |
var csv = ''; | |
for(var i = 0; i < data.length; i++) { | |
csv += data[i].join(',') + "\r\n"; | |
} | |
return ContentService.createTextOutput(csv); | |
} |
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
// CSVを取得するサンプルコード | |
var url = "https://script.google.com/macros/s/******************/exec"; | |
// 結果のCSV格納変数 | |
var csv = ""; | |
using (var request = UnityWebRequest.Get(url)) | |
{ | |
Debug.Log($"SEND!!! : {url}"); | |
yield return request.SendWebRequest(); | |
// 通信エラーチェック | |
if (request.isNetworkError) | |
{ | |
Debug.Log(request.error); | |
} | |
else | |
{ | |
if (request.responseCode == 200) | |
{ | |
// UTF8文字列として取得する | |
csv = request.downloadHandler.text; | |
Debug.Log($"Load Suuccess : {csv}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment