JavaScript Filter Method Tutorial - Google Sheets Apps Scripts - Array Methods Part 7

Поделиться
HTML-код
  • Опубликовано: 8 ноя 2024

Комментарии • 81

  • @eyemoksha
    @eyemoksha 2 года назад +1

    You are a Perfect Teacher. You have taught me a lot. THANK YOU for all your lessons.

  • @jmcanally3
    @jmcanally3 5 лет назад +3

    Thank you. This technique just saved me hours, days, months of frustration. Love the videos.

  • @rashidanwar7831
    @rashidanwar7831 5 лет назад +2

    You are really doing a great job. Thumbs up for your efforts and easy to understand teaching style. Thanks a lot.

  • @kafkareader3212
    @kafkareader3212 5 лет назад +2

    Thanx a lot, man. You give a lot of good information to up GS skills. I am from Russia and here i cant find a lot of answeres for my questions. You help a lot. Keep going and good luck. :)

  • @TinaFO-tc2dd
    @TinaFO-tc2dd 4 месяца назад

    Thank you for this video! I would like to know if there is a way of filtering by "value" and "background color". Thank you again!

  • @Barrel4336
    @Barrel4336 4 года назад +1

    This was good overview on filters for Apps Script, following your methods I was able to get a filter function to work, but I was not able to get the function to filter based on a specific date.
    This returns me an empty array and I was wondering if you had any advice for using the filter function for a dataset that has dates associated with it?

  • @yrin84
    @yrin84 4 года назад

    your videos are the best on this field!

  • @jarabialex
    @jarabialex 3 года назад +2

    Awesome! Awesome! Awesome!

  • @plinioglad
    @plinioglad Год назад

    Very good!!!!! Congratulations!!!

  • @joycekosak
    @joycekosak 3 года назад +1

    This is awesome, gave me exactly what I needed to know to get the data filtered. I also want to update the column next to my original data indicated that I have copied those rows that met the filter conditions. Any thoughts on how to do that? I filter and copy the data to another sheet, and I want the original sheet to now indicate "Submitted" to the lines that were copied over.

  • @danieldotimas1786
    @danieldotimas1786 3 года назад +1

    Thank you for this. May I ask how to Reset all existing filters in a sheet using script?

  • @daytodatainc.2520
    @daytodatainc.2520 3 года назад

    Great video, simplistic examples so it all makes sense!

  • @lowernorth9972
    @lowernorth9972 5 лет назад +1

    This would be great if it returned filtered items from a data validation drop down within the spreadsheet. Dig the videos, keep it up. Love the typos too XD

  • @adolfoenriquelobos8117
    @adolfoenriquelobos8117 4 года назад

    Excellent video!! It helps me to solve searches efficiently.
    My query is the following, How can I get the row in which the entered value was found? Thank you!

  • @bruno_snitram
    @bruno_snitram 2 года назад

    Awesome. Thank you for sharing.

  • @Ro0Dr1Gg0
    @Ro0Dr1Gg0 4 года назад +2

    Amazing!!! Thanks for share!!

  • @garychadwick1240
    @garychadwick1240 4 года назад +1

    Once again, thanks for another excellent tutorial. One question though. I’ve noticed that sometimes you use == and sometimes === in your formula. What’s the difference?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 года назад +2

      On a basic level:
      == checks for value only
      === checks for value and type
      example:
      4 === "4" IS NOT TRUE, because one is a number, the other is text. So the type is not the same.
      4 == "4" IS TRUE, because == doesn't check the type.

    • @garychadwick1240
      @garychadwick1240 4 года назад

      Learn Google Spreadsheets Makes perfect sense. Thanks for your fast response! 👌🏻

  • @MuriloMBarquette
    @MuriloMBarquette Год назад

    Fantastic!

  • @carmencastro5512
    @carmencastro5512 6 лет назад

    Here I found what I was looking for, thank you so much for sharing ......

  • @edwinalansilvatorres544
    @edwinalansilvatorres544 2 года назад

    Awesome 😃 Thanks!

  • @siocgsd7894
    @siocgsd7894 3 года назад

    Hello. I would like to know if this is, like, automated? Like when you add data it will be added on the filtered data on the tab that your appscript created. Or do you need to click run again?

  • @TheOrteme
    @TheOrteme 3 года назад

    MAN YOU DOING GREAT THING THANK YOU!

  • @michaeltimpano1278
    @michaeltimpano1278 4 года назад

    Great videos! Very helpful. How would you use filter or map to search the first row columns headings for a key word and then return all the rows that are in that column? I can pull all the rows with a filtered word, but not if the search is restricted to the first row. Any ideas? Thanks.

  • @lauramcooley
    @lauramcooley 2 года назад

    I feel like a fog has been lifted. Thank you!!

  • @mikemccartneyable
    @mikemccartneyable 6 лет назад

    Absolutely super channel and content.

  • @profleomartinez1551
    @profleomartinez1551 3 года назад

    Hi, excellent!
    I implement it in reading my students' spreadsheet. I separate one class from another and define it in a cell.
    Thank you!!

  • @home2office515
    @home2office515 3 года назад

    Nice video

  • @ajayshakti5818
    @ajayshakti5818 4 года назад +1

    Thanks ..

  • @luisgermanorregocampano1987
    @luisgermanorregocampano1987 2 года назад

    Impressive! Thank you very much for this tutorial. Do you still have your patreon?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 года назад

      Thank You! Yes www.patreon.com/chicagocomputerclasses

  • @giorgionatale7190
    @giorgionatale7190 3 года назад

    Nice video man, but just a question .
    How can you filter de color of
    The cell?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 года назад

      is you use getRange().getBackgrounds() instead of getRange().getValues() it will give you an array of colors in hex format.

    • @irfankalkar8461
      @irfankalkar8461 Год назад

      ​@@ExcelGoogleSheets I have already tried it, but this time we can't get the values of relevant rows as one column or as all columns which were filtered by color. Because, (firstly thanks for your video but) your video doesn't explain how to get Values of a row together with all columns if that row has relevant color which was expected to be found by filter.
      Also i want to make this filter as normal filter in same sheet by hiding the rows in which relevant value or background color are not found after filter query.
      Can you help me on this topic ?

  • @128MrAndy
    @128MrAndy 2 года назад

    Thanks!

  • @tonypeterson3477
    @tonypeterson3477 5 лет назад

    Thanks for this filter video guide. It is very useful. May I please know the scripts for the sale rep who are not "Jerry Jefferson"? I would greatly appreciate it if you could help me with this matter.
    Tony

  • @syscomseatings8964
    @syscomseatings8964 4 года назад

    This is great tutorial .. IS there a way where we can have one single function which will take multiple search as array and corresponding columns in which to search as an other array and search ie i want to search for "yes" in col3 , completed in col4 , >50 in col5 , I might not have all these 3 everytime... so how do i have a generic function which will run as per length of the search item/column arrays. Hope I am making sense :(

  • @pichit.raetai
    @pichit.raetai 5 лет назад

    Wow.. thank you very much

  • @andreaguerri.educational
    @andreaguerri.educational 3 года назад

    Hi, thanks...but I have a problem with between date array. For example: in my spreadsheets I have a colum with date, it's work currently with getMonth, getFullYear, but not working with between date. This is a code:
    var sheet = SpreadsheetApp.getActive();
    var ss = sheet.getSheetByName("Fatturato");
    var data = ss.getRange(4, 4, ss.getLastRow(), 4).getValues();
    var startDate = new Date("2017-01-01");
    var endDate = new Date("2022-01-01");
    var result = data.filter(function(row){
    var d = new Date( row[0] );
    return d.setDate() >= startDate && d.getDate

  • @thiagodecastroartiga8893
    @thiagodecastroartiga8893 3 года назад

    Man thanks again!!

  • @leorraedvalmonte
    @leorraedvalmonte 3 года назад

    How do use multiple criteria but for each criterion that is blank have it disregard the data and filter only based on criteria that is non blank?

  • @jasonmagee5988
    @jasonmagee5988 3 года назад

    Is there a way to place the results on an html form similar to your instructions for the search in a crud?

  • @iArthurTou
    @iArthurTou 5 лет назад

    Can this filter method can filter date between or filter date by criteria bigger than day , less than date ? How can do it . Thanks !

  • @ChallaRamakrishnaDynamicsAX
    @ChallaRamakrishnaDynamicsAX 5 лет назад

    Just amazing!!

  • @dme3327
    @dme3327 4 года назад

    HI, Could you please let me know how can i copy data with hyperlink format suppose i have data in which some cells have hyperlink and if copy data and paste it another sheet then hyperlink format should be same, is there any way to do this activity please do let me know

  • @KhalilYasser
    @KhalilYasser 6 лет назад +1

    Thank you very much. As for the link of the sheet, when trying to navigate to script editor, it doesn't appear. Can you share the code?

    • @KhalilYasser
      @KhalilYasser 6 лет назад

      Here's the code used the video. Hope this helps others
      pastebin.com/k9sC42Lq

  • @arielzabatecuizon5147
    @arielzabatecuizon5147 3 года назад

    Hi, how can I filter using partial string?, like I want to return all contains "tex".

  • @paulloup5210
    @paulloup5210 6 лет назад

    Thank you very much !!!

  • @ConsulthinkProgrammer
    @ConsulthinkProgrammer 3 года назад

    Sir, suppose I have script like this:
    var leaveFilter = data.filter(data => {return data[1 == "Annual Leave" || data[1] == "Vacation leave" || data[1] == "Sick" || data[1] == "Important leave"});
    How if I want make some iteration, or loop perhaps, so I just have to make that filter in array like this:
    filters = [ "Annual Leave", "Vacation leave", "Sick", "Important leave"]
    Which later I want that I could use that filters variable to do some iteration/loop in filter method above. Could you help to break this problem?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 года назад +1

      var leaveFilter = data.filter(data => {return [ "Annual Leave", "Vacation leave", "Sick", "Important leave"].includes(data[1])});

    • @ConsulthinkProgrammer
      @ConsulthinkProgrammer 3 года назад

      @@ExcelGoogleSheets Thanks a lot Sir. Perfectly works :D

  • @phoenixempire8886
    @phoenixempire8886 4 года назад +1

    🙏🏻

  • @jihenothmen3275
    @jihenothmen3275 3 года назад

    Hi
    thanks for this tutorial,
    when i insert a sheet i get an error message "ReferenceError: tab is not defined"

  • @ruchikabadesra5888
    @ruchikabadesra5888 3 года назад

    Hi. I used the same method to filter data and the same method to create a new sheet and paste data using setvalues(). But it is throwing an error - TypeError: Cannot read property 'length' of undefined. I checked that the filtered data is not empty. On logging out the length, it is giving numeric values. Can you please help?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 года назад +1

      Check your spelling, everything is case sensitive.

  • @ConsulthinkProgrammer
    @ConsulthinkProgrammer 3 года назад

    How if we want to filter by date which is first column in the video, Sir? I've tried something like this:
    var date1 = new Date("2/15/2017");
    var dateFilter = values.filter(function(r) { return r[0] == date1; });
    But it didn't work and I just got an empty []
    How we could do that correctly Sir?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 года назад +1

      var dateFilter = values.filter(function(r) { return r[0].getTime() == date1.getTime(); });

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 года назад +1

      Be careful with time zones when you do this.

    • @ConsulthinkProgrammer
      @ConsulthinkProgrammer 3 года назад

      @@ExcelGoogleSheets Thanks for your feedback and code Sir. I did a little bit of modification, then changed my time zone setting, considering your advice.. And, great, it works. Again, thanks a lot Sir :)

  • @shaitaan0666
    @shaitaan0666 Год назад

    how to filter between two dates match with it data

  • @jdee603
    @jdee603 3 года назад

    I followed the advice in the video but I keep getting an error message
    TypeError: originalData.filter is not a function (line 8, file "Code")
    function myFunction() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var trn = ss.getSheetByName("Transactions");
    var originalData = trn.getRange(2, 1, trn.getLastRow()-1,7).getValues;
    var salesRep = "Jerry Jefferson";
    var data = originalData.filter(function(item){ return item[1] === salesRep && item[4] > 300; });
    var targetSheet = ss.insertSheet(salesRep);
    targetSheet.getRange(2, 1, data.length, data[0].length).setValues(data);
    }
    Any help?

  • @ravisingh2234
    @ravisingh2234 4 года назад

    it's showing error like : TypeError: Cannot read property 'length' of undefined (line 12, file "Test")

  • @NishantKumar-tc5ej
    @NishantKumar-tc5ej 2 года назад

    This method is removing the header. It is possible to retain it?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 года назад

      let headers = data.shift()
      data = data.filter(logic)
      data.unshift(headers)

  • @tomas_thephotographer
    @tomas_thephotographer 4 года назад

    @Learn Google Spreadsheets, if I would like to at the end show in new sheet only 1 column and 7 column, how can I do it?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  4 года назад

      Use .map method ruclips.net/video/WA8QotNEVc4/видео.html

  • @EnnaNadanthaalum
    @EnnaNadanthaalum 2 года назад

    TypeError: Cannot read property '1' of undefined
    pls help

  • @sushilkumarthakur6033
    @sushilkumarthakur6033 3 года назад

    #Deliting row based on condition or when the condition met and copying deleted row in another sheet.
    &How to get a particular array when the condition met (filter method doesn't go well as it returns a whole array of rows)
    Can anyone help me out with any inputs and video links? It will be appreciated.

  • @dustinelliott-br2l359
    @dustinelliott-br2l359 5 лет назад

    Thank you. This is almost exactly what I am looking for, but I do not understand why I am receiving this error - TypeError: Cannot find function filter in object [object Array].- on this line: var data = originalData.filter(function(item){ return item[1] === salesRep && item[4] > 300; });

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  5 лет назад

      your error happens before that line.

    • @dustinelliott-br2l359
      @dustinelliott-br2l359 5 лет назад

      I tried again and it worked. I do not know why it did not work the first time. Thanks again. Very helpful videos.

    • @dustinelliott-br2l359
      @dustinelliott-br2l359 5 лет назад

      @@ExcelGoogleSheets If I had a dozen sales amounts that I wanted to filter on, and those amounts were in Col J of Transactions (rows 2-13), instead of writing several ||/or statements, is there a way I could incorporate indexOf into the filter function? That way, if the amounts in Col J changed, I would not need to modify the script. I saw something about indexOf > -1 online, but I cannot apply it correctly to this example. Thank you.

  • @66Komodo
    @66Komodo 5 лет назад

    👍🏻

  • @ลิขิตชัยกิจ
    @ลิขิตชัยกิจ 3 года назад

    It shown TypeError: originalData.filter is not a function (line 7, file "filter") /which is var data = originalData.filter(function(item){ return item[1] === "BA"; });

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 года назад

      That means check the line
      var originalData = blah blah;

  • @bdawg7132
    @bdawg7132 5 лет назад

    Wish it worked for me.