Get Sheet Done — using Google Spreadsheets as your data backend
Gilad Dayagi
3.9K26

You can also create your own customized web service using Google Sheets if you like. Google Apps Script will even pass you URL parameters as an object. (e.g. #param1=value1&param2=value2). This has the added benefit of constructing exactly what information you want to send back (even mimicking a service you want to eventually convert to) as well as keeping your sheet private.

Just add a doGet() function to your sheet’s script like so:

function doGet(e) {
var output = getOutputObjectFromSheet(e.parameter);
return ContentService.createTextOutput(JSON.stringify(output));
}
function getOutputObjectFromSheet(params) {
return { example: "Hello. I'm a web service now." };
}

Then use Publish > Deploy as Web App...

When you deploy, you will get a URL that is a REST web service driven by your Google Sheet behind the scenes.

It’s not the most responsive thing in the world, but definitely great for prototyping up a web API!

You can find more info on Google’s Web Apps help page.