Get information about cells changed in the Google Spreadsheet Change Notification in a machine-readable format

If I have Google Spreadsheet for example

https://docs.google.com/spreadsheet/ccc?key=0AjAdgux-AqYvdE01Ni1pSTJuZm5YVkJIbl9hZ21PN2c&usp=sharing

And I set up notifications on it to immediately send me an email whenever a cell changes.

And I make changes to the table using the spreadsheet API, i.e. not by hand.

Then I get the following email:

Subject: Notification Test has recently been modified

See the changes to your Google Doc Notification Test: click here

another person made changes from 10/01/2014 12:23 to 12:23 (Greenwich Average Time)

  • Values ​​changed

" ", URL-, , :

https://docs.google.com/a/DOMAINGOESHERE/spreadsheet/ver?key=tn9EJJrk6KnJrAEFaHI8E3w&t=1389356641198000&pt=1389356621198000&diffWidget=true&s=AJVazbUOm5tHikrxX-bQ0oK_XEapjEUb-g

:

, , . JSON?

API Google Spreadsheet: https://developers.google.com/google-apps/spreadsheets/

API Drive API: https://developers.google.com/drive/manage-revisions

onEdit() Google Apps Script: https://developers.google.com/apps-script/understanding_triggers

, .

, , onEdit , , , API .

?

+4
1

, . - . , . , , , , ( ).

var sheet = **whatever**;//The spreadsheet where you will be making changes
var range = **whatever**;//The range that you will be checking for changes
var compSheet = **whatever**;//The sheet that you will compare with for changes
function checkMatch(){
  var myCurrent = sheet.getRange(range).getValues();
  var myComparison = compSheet.getRange(range).getvalues();
  if(myCurrent == myComparison){//Checks to see if there are any differences
    for(i=0;i<compSheet.length;++i){ //Since getValues returns a 'multi-dimensional' array, 2 for loops are used to compare each element
     for(j=0;j<compSheet[i].length;++i){
      if(myCurrent[i][j] != myComparison[i][j]){//Determines if there is a difference;
       //***Whatever you want to do with the differences, put them here***
     }
    }

    myEmailer(sheet.getUrl());//Passes the url of sheet to youur emailer function 
    compSheet.getRange(range).setValues(myCurrent);//Updates compSheet so that next time is can check for the next series of changes
    }
  }

> checkMatch .

https://developers.google.com/gdata/samples/spreadsheet_sample json

+4

All Articles