Find in column and Copy it's row code for Google s

[Closed]
Report
-
 Nvcworld -
Hello,
I have created code in MS Excel for finding particular text in column and after finding text the entire row should be copy and add in next sheet after the Last entry but this code is not working for Google sheets.

can you please help me to create same code for Google sheets thanks in advance


2 replies


You have to write them in GOOGLE APPS SCRIPTS! Have FUN!
Yes , but being a mech engg i dont have knowedge of it and struglrd a lot , thats why i did this post
Blocked Profile
OK, lets look at this line:

if(v[i][0]==='Table') {


"[0]" is the Column, I believe. Arrays start at 0, so 0=a,1=b,2=c,3=d. I have not verified this, I am only looking at code and not referencing any documentation from Google. Test that and if that is the case, we will move on the second one.
> Blocked Profile
Hi master,

Yours suggestions is right, now it's changing column ...... Now I am playing with code for next level .
Your few lines pushed me few steps ahead.

Once again thanks
Blocked Profile
Post back if you get stuck. It makes me happy to know that I am just assisting with the help, and you are actually learning. Not just "cut and paste" like most here!
> Blocked Profile
Sir,
As per your guidance I played a lot to add copy row to add in next empty row but not getting success ... Even I tried to add 1 more item like pencil and pencil inventory sheet ..but not working...
Can you please guide me for same ?

Thanks & regards
> Nvcworld
Hi master,
I played full day to paste data in next row but failed .

This is my book ,

https://docs.google.com/spreadsheets/d/14t6QkiZ1CgBw22AnkSklq5TzwBkcq0Nje5hsMmcS-Ms/edit#gid=1207972376

its realy very hard for me , need yours guidens ,please and this is code


function xpc() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName('Sheet1');
var r = s.getDataRange();
var v = r.getValues();
var arr = new Array();
for(var i=0;i<v.length;i++) {
if(v[i][0]==='Table') {
arr.push(v[i]);
}
}

var t = ss.getSheetByName('Table');
t.getRange((t.getLastRow(),+1),1,arr.length,arr[0].length).setValues(arr);


//var ss = SpreadsheetApp.getActiveSpreadsheet();
// var s = ss.getSheetByName('Sheet1');
//var source = s.getRange('A:A');
// var destSheet = ss.getSheetByName('table');
// var destRange = destSheet.getRange(destSheet.getLastRow()+1,1);
//source.copyTo (destRange, {contentsOnly: true});

};

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!