Google Sheets API
googleapis · Analytics
Reads and writes Google Sheets.
Authentication
Sample Requests
Returns the spreadsheet at the given ID. The caller must specify the spreadsheet ID. By default, data within grids is not returned. You can include grid data in one of 2 ways: * Specify a [field mask](https://developers.google.com/sheets/api/guides/field-masks) listing your desired fields using the
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}?alt=json&key=YOUR_API_KEY&fields=example&ranges=example&$.xgafv=1&callback=example"aUser=example&uploadType=example&oauth_token=example&prettyPrint=true&access_token=example&includeGridData=true&upload_protocol=example"import requests
params = {
"alt": "json",
"key": "YOUR_API_KEY",
"fields": "example",
"ranges": "example",
"$.xgafv": "1",
"callback": "example",
"quotaUser": "example",
"uploadType": "example",
"oauth_token": "example",
"prettyPrint": "true",
"access_token": "example",
"includeGridData": "true",
"upload_protocol": "example"
}
response = requests.get(
"https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}');
url.searchParams.set('alt', 'json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('fields', 'example');
url.searchParams.set('ranges', 'example');
url.searchParams.set('$.xgafv', '1');
url.searchParams.set('callback', 'example');
url.searchParams.set('quotaUser', 'example');
url.searchParams.set('uploadType', 'example');
url.searchParams.set('oauth_token', 'example');
url.searchParams.set('prettyPrint', 'true');
url.searchParams.set('access_token', 'example');
url.searchParams.set('includeGridData', 'true');
url.searchParams.set('upload_protocol', 'example');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}")
q := baseURL.Query()
q.Set("alt", "json")
q.Set("key", "YOUR_API_KEY")
q.Set("fields", "example")
q.Set("ranges", "example")
q.Set("$.xgafv", "1")
q.Set("callback", "example")
q.Set("quotaUser", "example")
q.Set("uploadType", "example")
q.Set("oauth_token", "example")
q.Set("prettyPrint", "true")
q.Set("access_token", "example")
q.Set("includeGridData", "true")
q.Set("upload_protocol", "example")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}")
uri.query = URI.encode_www_form({
"alt" => "json",
"key" => "YOUR_API_KEY",
"fields" => "example",
"ranges" => "example",
"$.xgafv" => "1",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"includeGridData" => "true",
"upload_protocol" => "example"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}?" . http_build_query([
"alt" => "json",
"key" => "YOUR_API_KEY",
"fields" => "example",
"ranges" => "example",
"$.xgafv" => "1",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"includeGridData" => "true",
"upload_protocol" => "example"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Returns one or more ranges of values from a spreadsheet. The caller must specify the spreadsheet ID and one or more ranges.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values:batchGet?alt=json&key=YOUR_API_KEY&fields=example&ranges=example&$.xgafv=1&callback=example"aUser=example&uploadType=example&oauth_token=example&prettyPrint=true&access_token=example&majorDimension=DIMENSION_UNSPECIFIED&upload_protocol=example&valueRenderOption=FORMATTED_VALUE&dateTimeRenderOption=SERIAL_NUMBER"import requests
params = {
"alt": "json",
"key": "YOUR_API_KEY",
"fields": "example",
"ranges": "example",
"$.xgafv": "1",
"callback": "example",
"quotaUser": "example",
"uploadType": "example",
"oauth_token": "example",
"prettyPrint": "true",
"access_token": "example",
"majorDimension": "DIMENSION_UNSPECIFIED",
"upload_protocol": "example",
"valueRenderOption": "FORMATTED_VALUE",
"dateTimeRenderOption": "SERIAL_NUMBER"
}
response = requests.get(
"https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values:batchGet",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values:batchGet');
url.searchParams.set('alt', 'json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('fields', 'example');
url.searchParams.set('ranges', 'example');
url.searchParams.set('$.xgafv', '1');
url.searchParams.set('callback', 'example');
url.searchParams.set('quotaUser', 'example');
url.searchParams.set('uploadType', 'example');
url.searchParams.set('oauth_token', 'example');
url.searchParams.set('prettyPrint', 'true');
url.searchParams.set('access_token', 'example');
url.searchParams.set('majorDimension', 'DIMENSION_UNSPECIFIED');
url.searchParams.set('upload_protocol', 'example');
url.searchParams.set('valueRenderOption', 'FORMATTED_VALUE');
url.searchParams.set('dateTimeRenderOption', 'SERIAL_NUMBER');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values:batchGet")
q := baseURL.Query()
q.Set("alt", "json")
q.Set("key", "YOUR_API_KEY")
q.Set("fields", "example")
q.Set("ranges", "example")
q.Set("$.xgafv", "1")
q.Set("callback", "example")
q.Set("quotaUser", "example")
q.Set("uploadType", "example")
q.Set("oauth_token", "example")
q.Set("prettyPrint", "true")
q.Set("access_token", "example")
q.Set("majorDimension", "DIMENSION_UNSPECIFIED")
q.Set("upload_protocol", "example")
q.Set("valueRenderOption", "FORMATTED_VALUE")
q.Set("dateTimeRenderOption", "SERIAL_NUMBER")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values:batchGet")
uri.query = URI.encode_www_form({
"alt" => "json",
"key" => "YOUR_API_KEY",
"fields" => "example",
"ranges" => "example",
"$.xgafv" => "1",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"majorDimension" => "DIMENSION_UNSPECIFIED",
"upload_protocol" => "example",
"valueRenderOption" => "FORMATTED_VALUE",
"dateTimeRenderOption" => "SERIAL_NUMBER"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values:batchGet?" . http_build_query([
"alt" => "json",
"key" => "YOUR_API_KEY",
"fields" => "example",
"ranges" => "example",
"$.xgafv" => "1",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"majorDimension" => "DIMENSION_UNSPECIFIED",
"upload_protocol" => "example",
"valueRenderOption" => "FORMATTED_VALUE",
"dateTimeRenderOption" => "SERIAL_NUMBER"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Returns a range of values from a spreadsheet. The caller must specify the spreadsheet ID and a range.
Hover any highlighted part to learn what it does
curl -X GET "https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values/{range}?alt=json&key=YOUR_API_KEY&fields=example&$.xgafv=1&callback=example"aUser=example&uploadType=example&oauth_token=example&prettyPrint=true&access_token=example&majorDimension=DIMENSION_UNSPECIFIED&upload_protocol=example&valueRenderOption=FORMATTED_VALUE&dateTimeRenderOption=SERIAL_NUMBER"import requests
params = {
"alt": "json",
"key": "YOUR_API_KEY",
"fields": "example",
"$.xgafv": "1",
"callback": "example",
"quotaUser": "example",
"uploadType": "example",
"oauth_token": "example",
"prettyPrint": "true",
"access_token": "example",
"majorDimension": "DIMENSION_UNSPECIFIED",
"upload_protocol": "example",
"valueRenderOption": "FORMATTED_VALUE",
"dateTimeRenderOption": "SERIAL_NUMBER"
}
response = requests.get(
"https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values/{range}",
params=params,
)
print(response.json())const url = new URL('https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values/{range}');
url.searchParams.set('alt', 'json');
url.searchParams.set('key', 'YOUR_API_KEY');
url.searchParams.set('fields', 'example');
url.searchParams.set('$.xgafv', '1');
url.searchParams.set('callback', 'example');
url.searchParams.set('quotaUser', 'example');
url.searchParams.set('uploadType', 'example');
url.searchParams.set('oauth_token', 'example');
url.searchParams.set('prettyPrint', 'true');
url.searchParams.set('access_token', 'example');
url.searchParams.set('majorDimension', 'DIMENSION_UNSPECIFIED');
url.searchParams.set('upload_protocol', 'example');
url.searchParams.set('valueRenderOption', 'FORMATTED_VALUE');
url.searchParams.set('dateTimeRenderOption', 'SERIAL_NUMBER');
const response = await fetch(url);
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"net/url"
)
func main() {
baseURL, _ := url.Parse("https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values/{range}")
q := baseURL.Query()
q.Set("alt", "json")
q.Set("key", "YOUR_API_KEY")
q.Set("fields", "example")
q.Set("$.xgafv", "1")
q.Set("callback", "example")
q.Set("quotaUser", "example")
q.Set("uploadType", "example")
q.Set("oauth_token", "example")
q.Set("prettyPrint", "true")
q.Set("access_token", "example")
q.Set("majorDimension", "DIMENSION_UNSPECIFIED")
q.Set("upload_protocol", "example")
q.Set("valueRenderOption", "FORMATTED_VALUE")
q.Set("dateTimeRenderOption", "SERIAL_NUMBER")
baseURL.RawQuery = q.Encode()
targetURL := baseURL.String()
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values/{range}")
uri.query = URI.encode_www_form({
"alt" => "json",
"key" => "YOUR_API_KEY",
"fields" => "example",
"$.xgafv" => "1",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"majorDimension" => "DIMENSION_UNSPECIFIED",
"upload_protocol" => "example",
"valueRenderOption" => "FORMATTED_VALUE",
"dateTimeRenderOption" => "SERIAL_NUMBER"
})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.apis.guru/v2/specs/googleapis.com/sheets/v4/v4/spreadsheets/{spreadsheetId}/values/{range}?" . http_build_query([
"alt" => "json",
"key" => "YOUR_API_KEY",
"fields" => "example",
"$.xgafv" => "1",
"callback" => "example",
"quotaUser" => "example",
"uploadType" => "example",
"oauth_token" => "example",
"prettyPrint" => "true",
"access_token" => "example",
"majorDimension" => "DIMENSION_UNSPECIFIED",
"upload_protocol" => "example",
"valueRenderOption" => "FORMATTED_VALUE",
"dateTimeRenderOption" => "SERIAL_NUMBER"
]);
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- See official documentation for authentication and setup.
What can you build with Google Sheets API?
Google Sheets API is a Analytics API. Developers commonly use analytics APIs for:
- tracking product usage and user behaviour
- building custom reporting and BI dashboards
- measuring marketing and campaign performance
- running funnel, retention, and cohort analysis
- aggregating metrics from multiple data sources
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. Google Sheets API is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide