A Looker Studio custom connector is a Google Cloud–hosted Apps Script or Cloud Function that translates any third-party data source into the standardized schema Looker Studio (formerly Data Studio) needs for visualizations.
A Looker Studio custom connector is a lightweight web service—most commonly written in Google Apps Script—that implements Google’s getData()
, getSchema()
, and authentication interfaces. Once deployed to Google Cloud, it lets analysts query almost any REST, SQL, or file-based system from inside Looker Studio as if it were a native data source.
getData()
endpoint with user-provided parameters.clasp
CLI for local Apps Script development.# Install clasp if you haven’t
npm i -g @google/clasp
# Log in
clasp login
# Create a new script bound to a Cloud project
clasp create --type standalone --title "My Custom Connector"
Most third-party APIs require OAuth2. Install Google’s helper library:
npm install google-apps-script-oauth2 --save
Configure the flow in Code.gs
:
function getOAuthService() {
return OAuth2.createService('myService')
.setAuthorizationBaseUrl('https://provider.com/oauth2/auth')
.setTokenUrl('https://provider.com/oauth2/token')
.setClientId(PROP.getProperty('CLIENT_ID'))
.setClientSecret(PROP.getProperty('CLIENT_SECRET'))
.setCallbackFunction('authCallback')
.setPropertyStore(PropertiesService.getUserProperties());
}
getConfig()
function getConfig(request) {
var cc = DataStudioApp.createConfig();
cc.newTextInput()
.setId('project_id')
.setName('Project ID')
.setHelpText('Enter the numeric project identifier.');
return cc.build();
}
getSchema()
function getSchema(request) {
return {
schema: [
{name: 'date', label: 'Date', dataType: 'YEAR_MONTH_DAY', semantics: {conceptType: 'DIMENSION'}},
{name: 'impressions', label: 'Impressions', dataType: 'NUMBER', semantics: {conceptType: 'METRIC', isReaggregatable: true}}
]
};
}
getData()
function getData(request) {
var url = 'https://api.provider.com/v1/metrics?project=' + request.configParams.project_id;
var response = UrlFetchApp.fetch(url, {
headers: {Authorization: 'Bearer ' + getOAuthService().getAccessToken()}
});
var json = JSON.parse(response.getContentText());
var rows = json.data.map(function(r) {
return {
values: [r.date, r.impressions]
};
});
return {
schema: getSchema(request).schema,
rows: rows
};
}
clasp push
to upload code.Create a new data source, choose “Build Your Own” at the bottom, and paste the deployment ID. After authorizing, you should see your fields and be able to build charts.
CacheService
or Google Cloud Memorystore.isReaggregatable = true
only when safe (e.g., sums, counts).DataStudioApp.createConnectorError()
with actionable messages so users know what went wrong.--version
flag; Looker Studio caches deployments aggressively.getSchema()
and formatResponse()
helpers, then CI-deploy via GitHub Actions.Apps Script has memory/time limits, but you can stream data through Cloud Functions or BigQuery, then proxy results.
Unlisted deployments can remain private to your domain; only gallery connectors require a repo.
Field additions are backward-compatible. Use canBlend
carefully to avoid breaking blends.
// File: Code.gs
function getAuthType() {
return {type: 'NONE'}; // public API, no auth
}
function getConfig(request) {
var cc = DataStudioApp.createConfig();
cc.newTextInput()
.setId('subreddit')
.setName('Subreddit')
.setPlaceholder('e.g., r/dataengineering');
return cc.build();
}
function getSchema() {
return {schema: [
{name: 'created_utc', label: 'Date', dataType: 'YEAR_MONTH_DAY', semantics:{conceptType:'DIMENSION'}},
{name: 'score', label: 'Score', dataType: 'NUMBER', semantics:{conceptType:'METRIC', isReaggregatable:true}}
]};
}
function getData(request) {
var url = 'https://www.reddit.com/r/' + request.configParams.subreddit + '/top.json?limit=100&t=day';
var json = JSON.parse(UrlFetchApp.fetch(url, {muteHttpExceptions:true}).getContentText());
var rows = json.data.children.map(function(post) {
var p = post.data;
return {values: [Utilities.formatDate(new Date(p.created_utc*1000),'GMT','yyyyMMdd'), p.score]};
});
return {schema: getSchema().schema, rows: rows};
}
Galaxy is a SQL editor, so if your data already lives in a relational database—PostgreSQL, Snowflake, BigQuery—you can often skip the connector entirely. Have analysts query the tables directly in Galaxy, endorse the SQL, and share collections. Build a Looker Studio report on top of database connectors, which are first-class and require no code.
Custom connectors let teams visualize data from systems that lack native Looker Studio support. Instead of exporting CSVs or building one-off dashboards, you deliver a reusable, governed integration that any analyst can use with zero code. This accelerates time-to-insight, reduces manual work, and keeps stakeholders in the BI tool they already know.
Google officially supports JavaScript (Apps Script) and any language that can run in Cloud Functions or Cloud Run. JavaScript is most common because deployment is frictionless.
No. Apps Script runs on Google’s infrastructure. For heavy workloads you can proxy to Cloud Functions or an external server, but many connectors remain 100% serverless.
getData()
run?The hard limit is 30 seconds for Apps Script. For longer jobs, pre-aggregate data in BigQuery or cache results in Cloud Storage and stream small chunks.
Yes. If your data source is a SQL database, Galaxy’s modern editor and AI copilot let you build and share queries faster than writing a connector. Then use Looker Studio’s built-in database connection to visualize the results.