ホーム

Copy between Spreadsheet GAS

environment

  • Google Apps Script
  • SpreadsheetApp
  • getActiveSheet
  • getSheets
  • getRange

 

When the line is changed by monitoring the entire line, the value is copied to the specified line of another sheet

Try copying the spreadsheet line to another spreadsheet line using Google Apps Script.

 

Copy the entire row using getSheets () and getRange

If you write like getRange ('D: D'), you can specify the entire d line. Then copy all of the changes in the D line of the copy source to the B line of a different spreadsheet with the description ss_copyTo.getRange ('B: B').

  //Retrieve the current spreadsheet
  var ss_copyFrom = SpreadsheetApp.getActiveSheet();
 //The id of the destination spreadsheet
  var ss_copyTo = SpreadsheetApp.openById('1DtH6QACaBynUJrrAG9qvP3CqY************');
  //Sheet name in the destination spreadsheet
  var sheet_copyTo = ss_copyTo.getSheets()[0];
  //Specify the cell in the copy source sheet
  var copyValue = ss_copyFrom.getRange('D:D').getValues();
  //Specify the cell in the copy destination sheet and execute copy
  ss_copyTo.getRange('B:B').setValues(copyValue);

-ホーム

Copyright© off , 2020 All Rights Reserved Powered by AFFINGER5.