0
votes

I want to copy data from the last row of my master sheet which populates using a google form and paste it into a new sheet that is created when a form is submitted. Now, I want the new sheet to automatically put certain text in specific cells and copy data from the last row in some specific cells. Example-: The master sheet

now i want to copy the data in cell b2 (assuming 2 is the last row) to newly created sheet in the cell b1 from cell c2 to b3 from cell d2 to b4 from cell AL2 to h20 and so on. I am new to google appscript. Any help would be appreciated.

1
From my understanding, you try to get the last line in your first sheet and put it as column in the second ? Or maybe I understand it wrongly ?Pierre-Marie Richard
I put text data in a column and other data in a table.Yogesh Dangi

1 Answers

0
votes

I don't what you meant by and so on. But here's the instructions that you specified so far.

function copyMasterToNewSheet()
{
  var ss=SpreadsheetApp.getActiveSpreadsheet();
  var sht=ss.getSheetByName('The Master Sheet');
  var rng=sht.getDataRange();
  var rngA=rng.getValues();
  var row=rngA[rngA.length-1];
  var newsht=ss.insertSheet(row[0]);//It's name is the TimeStamp
  newsht.getRange('B1').setValue(row[1]);
  newsht.getRange('B3').setValue(row[2]);
  newsht.getRange('B4').setValue(row[3]);
  newsht.getRange('H20').setValue(row[37]);
  SpreadsheetApp.flush();
}

You would need to hook this up to the on Form Submit trigger.