Copy rows automatically to new sheet with Google Apps Script -


i have spreadsheet information on, , want copy across second sheet automatically. want copy across automatically when insert new rows within rows copied across. found code below don't understand have do want, or if need add anything. have basic coding knowledge not much, if explain appreciated.

function myfunction() { var source = spreadsheetapp.openbyid('xxxxxx'); var sourcesheet = source.getsheetbyname('sheet1'); var target = spreadsheetapp.openbyid('xxxxx') var targetsheet = target.getsheetbyname('sheet1'); var rangevalues = sourcesheet.getrange(2, 1, sourcesheet.getlastrow(), sourcesheet.getlastcolumn()).getvalues(); targetsheet.appendrow(rangevalues);  } 

you can more using =importrange() function, e.g. =importrange("https://docs.google.com/spreadsheets/d/10x7kggfd4u8iwqo4qgunmlmphtwwef9bgwfu3vrm3am/","sheet1!a:z")

put formula in second spreadsheet, replace url url of first spreadsheet (i put example one) , tweak "sheet_name!range" need. 2nd spreadsheet automatically update whenever inputted range of 1st spreadsheet changes :)

hope helps!


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -