0
votes

Situation:

I need to copy same data from Sheet1 to Sheet2.

Sheet1: Has 19 Columns
Sheet2: Has 5 Columns

I want to copy data from a specific column on Sheet1 and paste to Sheet2 only if in column 14 has data starting from row 3.

Source Data:

var source = ss.getSheetByName("Sheet1");
var lastrow = Support.getLastRow();
var data1 = Support.getRange(3, 1, lastrow).getValues(); // XML ID
var data2 = Support.getRange(3, 2, lastrow).getValues(); // SEQ NAME
var data3 = Support.getRange(3, 14, lastrow).getValues(); // Notes
var data4 = Support.getRange(3, 19, lastrow).getValues(); // Time Date

I need to copy the data only if the data3 has data to Sheet2 in the lastrow. I mean this script will run as trigger and Sheet2 will be a historic the information will be put in the lastrow in Sheet2 in this order:

data1 >> Sheet2 in Column 1 (A)
data2 >> Sheet2 in Column 2 (B)
data3 >> Sheet2 in Column 3 (C)
data4 >> Sheet2 in Column 4 (D)

I will appreciate any help.

1
at first, add 4 spaces before each codelineJonas Wilms

1 Answers

0
votes

Ok, just to clarify for myself here.

So, you want to take 4 columns worth of data and add them in a specific order into your Archive (Sheet 2). BUT only if Column 14 contains "X".

Do you want the information CUT from sheet 1 into sheet 2 or copied?

I'm a little rusty but will give it a try.

Any sample information would also be helpful for testing.

Chris