Reputation: 663
I am using Google Spreadsheets as a JSON database (I know, not totally reliable or the best option). I was wondering If I could somehow "watch" this database for edits, or if I could send a trigger from the database to a web application upon edits of the content?
Thanks
Upvotes: 0
Views: 108
Reputation: 31310
Manual edits? For manual edits, create an onEdit()
function.
Google Documentation - Simple Triggers
If the spreadsheet is getting data written to it through a Google Apps Script that is NOT under your control, then you could have a time driven trigger that is checking the spreadsheet at regular intervals.
Upvotes: 0
Reputation: 6770
You can use Google Apps Scripts. Which is a scripting language based on JavaScript that lets you do add functionalities to Google Sheets and other Google products.
You can go in Tools -> Script Editor in your spreadsheet. There you can create functions triggered on editing the sheet.
Example of a Google Apps Script function:
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
for (var i = 0; i <= numRows - 1; i++) {
var row = values[i];
Logger.log(row);
}
You may need to use URL Fetch Service to make a request on your application whenever a row or cell is changed.
Upvotes: 1