简体   繁体   中英

How to import a range of a sheet without specific cells?

I want to import data from one sheet to another sheet. The sheet is containing data under the date. The range i want to import is containing values named "APP-XX" and "KRL-XX". And there is a value just under specified value. I want to import the values in another sheet which has the phrase "APP" including the number(XX). but not "KRL-XX" Please have a look at the below screen shot.

enter image description here

In picture, I want to import all the cells except "KRL-XX" and the values just below of this. Actually I want to import the whole sheets to another sheet except cells containing "KRL-XX" and the values below "KRL-XX".

Can you please let me know the formula or ways to import it on another sheet??? A link is given below.

https://docs.google.com/spreadsheets/d/1NTfGVDR04cFoTLsjcKKQvplXyFGL1x2Z3FcwxrvKLHs/edit#gid=1130925705

Thanks in advance.

I think this will do it.

function everythingExcept() 
{
    var ss=SpreadsheetApp.getActive();
    var sht=ss.getSheetByName('Sheet66');
    var des=ss.getSheetByName('Sheet67');
    var rng=sht.getDataRange();
    var rngA=rng.getValues();
    var rngB=rng.getBackgrounds();
    var re=/(SPL-\d{2}|BPL-\d{2})/
    for(var i=0;i<rngA.length;i++)
    {
      for(var j=0;j<rngA[0].length;j++)
      {
        if(rngA[i][j])
        {
          if(String(rngA[i][j]).match(re))
          {
            rngA[i][j]='';
            rngA[i+1][j]='';
            rngB[i][j]='#ffffff';
            rngB[i][j]='#ffffff';
          }
        }
      }
    }
    des.getRange(1,1,rngA.length,rngA[0].length).setValues(rngA);
    des.getRange(1,1,rngA.length,rngA[0].length).setBackgrounds(rngB);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM