Google Sheets to JSON
Script Usage Documentation
Google Sheets to JSON
Script Usage Documentation
// Put your GAS Web app URL here.
const url = "PUT_YOUR_JSON_URL_HERE";
fetch(url)
.then(res => res.json())
.then(json => {
const data = json.data;
console.log(data);
// Process your JSON data here...
})
// Put your GAS Web app URL here.
var url = "PUT_YOUR_JSON_URL_HERE";
$.getJSON(url, function (json) {
console.log(json.data);
// Process your JSON data here...
});
<?php
// Put your GAS Web app URL here.
$url = "PUT_YOUR_JSON_URL_HERE";
$json = json_decode(file_get_contents($url));
$rows = $json->data;
foreach($rows as $row) {
var_dump($row);
}
?>
// Put your details here.
const sheetID = "PUT_YOUR_SHEET_ID_HERE";
const sheetName = "PUT_YOUR_SHEET_NAME_HERE";
const apiKey = "PUT_YOUR_API_KEY_HERE";
fetch("https://sheets.googleapis.com/v4/spreadsheets/" + sheetID + "/values/" + sheetName + "?key=" + apiKey)
.then(res => res.json())
.then(json => {
const data = json.values;
console.log(data);
// Process your JSON data here...
})
// Put your details here.
var sheetID = "PUT_YOUR_SHEET_ID_HERE";
var sheetName = "PUT_YOUR_SHEET_NAME_HERE";
var apiKey = "PUT_YOUR_API_KEY_HERE";
var url = "https://sheets.googleapis.com/v4/spreadsheets/" + sheetID + "/values/" + sheetName + "?key=" + apiKey;
$.getJSON(url, function (json) {
console.log(json.values);
// Process your JSON data here...
});
<?php
// Put your API key here.
define("API_KEY", "PUT_YOUR_API_KEY_HERE");
// Replace {sheetId} and {sheetName} with your actual Sheet ID & Name.
$url = sprintf("https://sheets.googleapis.com/v4/spreadsheets/{sheetId}/values/{sheetName}?key=%s", API_KEY);
$json = json_decode(file_get_contents($url));
$rows = $json->values;
foreach($rows as $row) {
var_dump($row);
}
?>