google apps script - Two Way sync that only copies edited cell, not entire worksheet -


this script (when applied both sheets -a , b) sync changes across both worksheets every time cell edited. i'd rather not learn javascript myself know answer question.

but i'm wondering if there's way specify process more contents of specific cell edited (in sheet a) copied on other worksheet (b) when change made. opposed entire worksheet. if make change in worksheet a, cell d3. cell copied on sheet b's d3 -and not else.

var sourcespreadsheetid = "id here"; var sourceworksheetname = "sheet name here"; var destinationspreadsheetid = "id here"; var destinationworksheetname = "sheet name here";  function importdata() {   var thisspreadsheet = spreadsheetapp.openbyid(sourcespreadsheetid);   var thisworksheet = thisspreadsheet.getsheetbyname(sourceworksheetname);   var thisdata = thisworksheet.getdatarange();   var tospreadsheet = spreadsheetapp.openbyid(destinationspreadsheetid);   var toworksheet = tospreadsheet.getsheetbyname(destinationworksheetname);   var torange = toworksheet.getrange(1, 1, thisdata.getnumrows(),    thisdata.getnumcolumns())   torange.setvalues(thisdata.getvalues());  

}

yes, can done, , that's way should done. code uses getrange() know that. change number of columns , rows include in range one. so, change thisdata.getnumrows() 1. same thisdata.getnumcolumns(). rid of that, , enter number 1. first 2 arguments 1,1 need change. first setting starting row, second setting starting column. if copying 1 cell, don't need use version of getrange() takes 4 parameters. there lots of different versions of getrange() , there 2 ways set values; setvalue() , setvalues(). if want set value of 1 cell, use setvalue() - (no "s" on end)


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -