App Script Tutorial - Google Sheets - For Loops, Looping Through Cells, Variables, Comments - Part 2

Sdílet
Vložit
  • čas přidán 5. 09. 2024
  • Video tutorial series about Apps Script (JavaScript) in Google Sheets (Excel VBA Equivalent).
    In this tutorial we'll cover how to work with variables, for loops, how to write comments in Google Sheets script editor.
    Google Sheets
    www.google.com...
    Website:
    www.chicagocom...

Komentáře • 114

  • @myvsecretary1859
    @myvsecretary1859 Před 6 lety +6

    Its my first time writing code and your teaching was so effective I understood it conceptually before I could even do it physically. Everyone tried to show me physically but I couldn't get it because I didn't understand it conceptually.
    Once you explained App then Spreadsheet then sheet then cell, I got it instantly, and I was visualizing the same process for forms, docs, email etc. You showed me where to find the "Holy Grail" of functions, and showed me how to fit them together. Now It is now up to me to be creative and mix and match the functions that I need to do whatever and lay them out in that particular order.
    Its like learning how to walk everyone else told me to put one foot in front of the other..You brought me a skeleton, showed me how the bones and muscles worked, and with that I realized I can run walk jump, hop skip and dance.
    halfway through your video I was changing background color, string color, and trying all sort of experiments from the function list. I even wrote all the var code in one line with multiple "." to see if it worked and surprisingly it did to some degree.
    give a man fish he feeds for a day, teach a man how to fish you feed him for a lifetime.
    With this video you didn't teach me how to code, you taught me how to get what i need and how to put it together, that's not coding that's survival.
    function learnBasics(){
    var app = SpreadsheetApp;
    var ss = app.getActiveSpreadsheet();
    var sheet = ss.getActiveSheet();

    sheet.getRange("A:Z").setValue("A Big Thank You");
    sheet.getRange("A:Z").setBackground("#d7f442");
    sheet.getRange("F7:F11").setBackground("#5a6b06");
    sheet.getRange("L7:L11").setBackground("#5a6b06");
    sheet.getRange(24,6).setBackground("#5a6b06");
    sheet.getRange(25,6).setBackground("#5a6b06");
    sheet.getRange(26,7).setBackground("#5a6b06");
    sheet.getRange(27,7).setBackground("#5a6b06");
    sheet.getRange(28,8).setBackground("#5a6b06");
    sheet.getRange(29,8).setBackground("#5a6b06");
    sheet.getRange(30,9).setBackground("#5a6b06");
    sheet.getRange(31,9).setBackground("#5a6b06");
    sheet.getRange(29,10).setBackground("#5a6b06");
    sheet.getRange(28,10).setBackground("#5a6b06");
    sheet.getRange(27,11).setBackground("#5a6b06");
    sheet.getRange(26,11).setBackground("#5a6b06");
    sheet.getRange(25,12).setBackground("#5a6b06");
    sheet.getRange(24,12).setBackground("#5a6b06");

  • @bocobox
    @bocobox Před 4 lety

    I am moving back and forth your videos. now I am getting a glimpse of App script. thank you.

  • @bryangruesoo8971
    @bryangruesoo8971 Před 3 lety +2

    Thanks for those videos, i was really trying to make a script for a db in sheets and after many hours searching and having errors, your explication give me an idea of how does those scripts function and i solved my problem. You saved my :)

  • @wilsonparry9341
    @wilsonparry9341 Před 6 lety +3

    Ive gone thru so many of these and finally someone that can explain it. Even the google guys can't explain as well as you. Good job - ill check out the next couple

  • @admireargumentactivity
    @admireargumentactivity Před 6 lety +3

    Your first tutorial was the best tutorial I've ever seen, any genre. Good work! I hope this one is just as good.

  • @vishalvarshney2883
    @vishalvarshney2883 Před 4 lety +2

    Excellent way of Teaching......Thank You !

  • @getclean2042
    @getclean2042 Před 3 lety +1

    i just discovered these videos and they are SO GREAT! Thanks a lot!!

  • @MyDearFriend
    @MyDearFriend Před 3 měsíci

    amazing tutorial so excited to see the whole series!!

  • @matusalemdamarin4060
    @matusalemdamarin4060 Před 4 měsíci

    já assisti vários vídeos desse cara, ele explica muito bem! Material gratuito de qualidade!

  • @KhJinnatulIslam
    @KhJinnatulIslam Před 11 měsíci

    Best video to learn Google apps script

  • @khoile4477
    @khoile4477 Před rokem

    never thought one of the best way to learn basic Javascript was thru Google Sheets, thank you!

  • @yuentl
    @yuentl Před 5 lety +13

    The actual discussion of how to run a for loop starts around 11:45

  • @tejaspanchal6089
    @tejaspanchal6089 Před 4 lety +1

    Great! You make it so easy to understand. It is just my day 2 of learning and I am enjoying it, thanks to you.

  • @richardazu7445
    @richardazu7445 Před 2 lety

    Thanks for sharing great videos always

  • @autobotgeekse
    @autobotgeekse Před rokem

    Excellent stuff. Very good way of explaining the code. Keep it up and thanks a lot for creating these videos. Wish you all the best

  • @booteesstudio7559
    @booteesstudio7559 Před 8 měsíci

    Thansks Sir for your detailed explanation.

  • @danielafreitas7071
    @danielafreitas7071 Před 3 lety +4

    Thank you!!! (from Brazil)

  • @mountainboy9044
    @mountainboy9044 Před 3 lety

    You are really great !!May lord shiva bless you with everything

  • @21GRINDERS
    @21GRINDERS Před 3 lety

    nice! very simply for use. thanks for the video

  • @shouldigetit
    @shouldigetit Před rokem

    Thank you!

  • @javaejercicios4442
    @javaejercicios4442 Před 4 lety

    Nice job. Most of the time, I use functional programming instead of traditional loops.

  • @KashifZahid
    @KashifZahid Před 6 lety +1

    Excellent tutorials! It has helped me a lot.

  • @Royowski01
    @Royowski01 Před 5 lety

    Hi Code Teacher,
    Thanks for your good explanation about the For Loop !!

  •  Před 5 lety +1

    Tremendous tutorials! :D Thanks for sharing!

  • @emthik9615
    @emthik9615 Před 5 lety

    Great teaching .. thanks

  • @valentinkhoroshkov9709

    Thank you very much, you are very good at explaining!

  • @ezequielaranda9400
    @ezequielaranda9400 Před 6 lety +1

    Thank you so much! This has literally saved my! THANKS!

  • @damianslaczka5219
    @damianslaczka5219 Před 7 lety +1

    These are really great! Thank you!

  • @pdmadv1056
    @pdmadv1056 Před 6 lety

    Wonderful tutorials, thanks!

  • @sauau9588
    @sauau9588 Před 3 lety +1

    great

  • @marcelcharest7662
    @marcelcharest7662 Před 5 lety +1

    Merci! (Thank you!) from Montréal

  • @jessebird8825
    @jessebird8825 Před 3 lety +1

    my unimportant comment (MUC) ... 1:42 Some versions of Fortran allowed spaces in variable names.

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  Před 3 lety

      How did the interpreter know that the variable declaration was over?

  • @NiyazuddinMohammedHyd
    @NiyazuddinMohammedHyd Před 5 lety +1

    You are awesome.!!

  • @vaidiksirsate
    @vaidiksirsate Před 11 měsíci

    Great

  • @HariOmJpr3715
    @HariOmJpr3715 Před 2 lety

    Also give the link of the previous videos you refer to in the description.

  • @eugenioremedi7380
    @eugenioremedi7380 Před 5 lety

    I want to learn more about loops and copying ranges to another sheet, in order to take the answers from a Google Forms form and convert them into a sheet with a list format (to use it as the base list for a pivot table). Could you help me?. Thank you for your time and sorry for such a long text!

  • @commieRob
    @commieRob Před 7 lety +1

    Hello! Thanks for the wonderful tutorials, I'm really enjoying them. Question: is there a way that I can define a variable in the Script Editor and then use it in Google Sheets itself? Thanks in advance.

  • @mrsmoove808
    @mrsmoove808 Před 5 lety

    smooth coding

  • @rishirishi4970
    @rishirishi4970 Před 2 lety

    Thanks

  • @krisspinden
    @krisspinden Před 4 lety +1

    How does i++ mean that it is increasing by 1? How do you make it increase by a different amount?

  • @masterhenyo7988
    @masterhenyo7988 Před 4 lety

    It is possible to set the variable outside and before the for loop? If is possible will it affect the speed of the code since the variable only set once unlike setting it everytime the code loops?

  • @DocPosture
    @DocPosture Před 6 lety

    2 words... awesomesauce

  • @cary6652
    @cary6652 Před 3 lety

    I have no idea how this is working, but I got it working with this.
    for(var i=1;i

  • @kerssful
    @kerssful Před 3 lety

    i love it!

  • @luisforni86
    @luisforni86 Před 3 lety

    Hello, how can you do a FOR loop with two columns? Ex: phone number and message

  • @climbeverest
    @climbeverest Před 5 lety

    Nice

  • @Wemyes
    @Wemyes Před 6 lety

    Why there is no saveAndClose () for sheets in app script. My sheets get modified in app script and when emailed automatically in app script , it sends the unmodified email. Help

  • @vishutomar1706
    @vishutomar1706 Před 3 lety

    is there a way to hide sheet tabs (only tabs and not sheet) in google sheets ?

  • @matiasaranda5850
    @matiasaranda5850 Před 4 lety

    sos un crack

  • @akankshapandey429
    @akankshapandey429 Před 6 lety

    Do you have any video that talks about "how to create folder in Google Drive and the folder contains n number of spreadsheets"

  • @SunilKumar-ln2vr
    @SunilKumar-ln2vr Před 4 lety

    I don't get any reference when I write code like at this place 1:04 it pops up a lot of options. I also want that in my app script please help me

  • @singhalmonica
    @singhalmonica Před 4 lety

    Pls help me to use vlookup fn. By script, dynamically.

  • @PaulSmithVPS
    @PaulSmithVPS Před 5 lety

    My R1C1 references don't seem to work like in the video. I can only use A1. Anybody know why?

  • @GameOverFiles
    @GameOverFiles Před 2 lety

    How were you able to getRange() using a string and a number? Mine errors expecting me to use "A1:B2" format. It won't let me use i+8

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  Před 2 lety

      You need to use getRange() on a worksheet object, not a spreadsheet object.

  • @hecatoplex5506
    @hecatoplex5506 Před 5 lety

    How do you loop through an array of OverGridImages?

  • @user-zn5yt7iy1s
    @user-zn5yt7iy1s Před 10 měsíci

    Sir can you help with google sheet scripts

  • @emilolorunadeolujoshua1788

    please sir if you can always shear the link to your earlier lesson(I mean part one
    ) on descriptions so that we can browse them faster. thanks so much

  • @tazulislam2698
    @tazulislam2698 Před 4 lety

    Bro! which version are you using?

  • @ernita1264
    @ernita1264 Před 2 lety

    Hi! Question: how do you make a loop of the code and stops when it finds an empty cell?

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  Před 2 lety

      You use a while loop with an if statement, but this is not a good practice. Most of the time there is a better way to approach this.

    • @ernita1264
      @ernita1264 Před 2 lety

      @@ExcelGoogleSheets can you provide me with an example for this? Let's say if a column has an empty cell, it stops the program/loop

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  Před 2 lety

      var ss = SpreadsheetApp.getActive();
      var sheet = ss.getActiveSheet();
      var cell = ss.getCurrentCell();
      var cellValue = cell.getValue();
      while (cellValue != "") {
      cell = cell.offset(1, 0);
      cellValue = cell.getValue();
      }

    • @sam_safari
      @sam_safari Před 4 měsíci

      @@ExcelGoogleSheets very helpfull

  • @pathakullahrabiya7397
    @pathakullahrabiya7397 Před 3 lety

    Can make user form in google sheet like as excel vba?

  • @TheJPZone
    @TheJPZone Před 4 lety

    Could you please assist.. A code to get a active cell after A1 and till last active cell.. Which means range that should be the active cell which is next to A1 and. Active();
    Please help

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  Před 4 lety +1

      get last row and last column from the active cell and use them inside getRange(1,1,lr,lc)

  • @CreemosEnJesucristo
    @CreemosEnJesucristo Před 6 lety

    Excelente video ... cómo puedo filtrar una hoja en google sheet ? cuál sería el código o script ? God Bless You.

  • @montecristobal
    @montecristobal Před 6 lety

    Hi! thanks for sharing. What about using "let" or "const" instead of "var" to declare variables? I am doing a course in Codeacademy and they are not using "var" anymore.
    Thank you.

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  Před 6 lety +1

      As far as I know Apps Script doesn't support ES6 at this point, so you'll need to stick with var for now.

    • @sam_safari
      @sam_safari Před 4 měsíci

      @@ExcelGoogleSheets interesting explanation

  • @phoenixempire8886
    @phoenixempire8886 Před 4 lety

    🙏🏻

  • @siddharthjain6629
    @siddharthjain6629 Před 4 lety

    Sir i have difficulty in running for loop i understood the concept of for loop but it is not working and taking lot of time to load can ypu help me on that

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  Před 4 lety

      czcams.com/video/985XJOeigpA/video.html

    • @siddharthjain6629
      @siddharthjain6629 Před 4 lety

      @@ExcelGoogleSheets sir i have watched this video of arrays of arrays and it is very much help ful when we are dealing with large no data but i am trying for lop for very small data range then also its not working 😢😢

    • @siddharthjain6629
      @siddharthjain6629 Před 4 lety

      And it is easy but i dont why its not working at first i tried by myself i didnt work then i did step by step as per your video then also not working

    • @sam_safari
      @sam_safari Před 4 měsíci

      @@siddharthjain6629 u gotta uptade the version of you script

  • @dangkhanhlinh476
    @dangkhanhlinh476 Před 4 lety +1

    the name part 2 let move at the Begin of video name.

  • @nayltonlopes8688
    @nayltonlopes8688 Před 4 lety

    Hi Everyone, How can I apply a "breakpage" on spreadsheet using Google Script?
    Thank you all!

  • @sam_safari
    @sam_safari Před 5 měsíci

    you are ready know

  • @trueordrue
    @trueordrue Před 2 lety

    16:33

  • @charlesmurray322
    @charlesmurray322 Před 5 lety

    Has anyone found part 1 of this tutorial ?

  • @shabnambibi2380
    @shabnambibi2380 Před 3 lety

    please help me

  • @thebrucecyou
    @thebrucecyou Před 5 lety +1

    Half of the video is the same stuff as the last video

    • @sam_safari
      @sam_safari Před 4 měsíci

      u gotta be sure of your words but they are very different

  • @matthieuingala9948
    @matthieuingala9948 Před 4 lety

    great

  • @NamHaVblog
    @NamHaVblog Před 3 lety

    thanks