Skip to content

Instantly share code, notes, and snippets.

@takashicompany
Last active December 20, 2015 01:29
Show Gist options
  • Save takashicompany/6048945 to your computer and use it in GitHub Desktop.
Save takashicompany/6048945 to your computer and use it in GitHub Desktop.
<?php
//======スプレッドシートの取得 ここから======
require './hoge/Ghostsheet.php';
$gs = new Ghostsheet();
$gs->set('cache', './hoge');
$mySpreadsheetId = 'hogehogehoge'; //スプレッドシートのIDを設定
$data = $gs->load($mySpreadsheetId); // $dataに加工されたデータが格納されます
//======スプレッドシートの取得 ここまで======
//======JSON化 ここから======
$log_all = $data['items']; //スプレッドシートのデーターを連想配列型で取得。
$json_hash = json_encode($log_all); //連想配列をJSON型文字列へ変換。
echo $json_hash; //JSON文字列を出力。
//======JSON化 ここまで======
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment