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

Поділитися
Вставка
  • Опубліковано 25 сер 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...

КОМЕНТАРІ • 114

  • @myvsecretary1859
    @myvsecretary1859 6 років тому +5

    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");

  • @bryangruesoo8971
    @bryangruesoo8971 3 роки тому +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 :)

  • @bocobox
    @bocobox 4 роки тому

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

  • @admireargumentactivity
    @admireargumentactivity 6 років тому +3

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

  • @khoile4477
    @khoile4477 Рік тому

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

  • @wilsonparry9341
    @wilsonparry9341 6 років тому +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

  • @MyDearFriend
    @MyDearFriend 2 місяці тому

    amazing tutorial so excited to see the whole series!!

  • @matusalemdamarin4060
    @matusalemdamarin4060 4 місяці тому

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

  • @getclean2042
    @getclean2042 3 роки тому +1

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

  • @vishalvarshney2883
    @vishalvarshney2883 4 роки тому +2

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

  • @tejaspanchal6089
    @tejaspanchal6089 4 роки тому +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.

  • @danielafreitas7071
    @danielafreitas7071 3 роки тому +4

    Thank you!!! (from Brazil)

  • @autobotgeekse
    @autobotgeekse Рік тому

    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 8 місяців тому

    Thansks Sir for your detailed explanation.

  • @yuentl
    @yuentl 5 років тому +12

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

    • @frankzvovu
      @frankzvovu 4 роки тому

      LOL

    • @johnwaas4864
      @johnwaas4864 4 роки тому

      For the people who actually came to this video prepared lol

  • @KhJinnatulIslam
    @KhJinnatulIslam 11 місяців тому

    Best video to learn Google apps script

  • @richardazu7445
    @richardazu7445 2 роки тому

    Thanks for sharing great videos always

  • @mountainboy9044
    @mountainboy9044 3 роки тому

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

  • @shouldigetit
    @shouldigetit Рік тому

    Thank you!

  • @21GRINDERS
    @21GRINDERS 3 роки тому

    nice! very simply for use. thanks for the video

  • @KashifZahid
    @KashifZahid 6 років тому +1

    Excellent tutorials! It has helped me a lot.

  • @javaejercicios4442
    @javaejercicios4442 4 роки тому

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

  • @Royowski01
    @Royowski01 5 років тому

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

  • @valentinkhoroshkov9709
    @valentinkhoroshkov9709 6 років тому

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

  • @ezequielaranda9400
    @ezequielaranda9400 6 років тому +1

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

  • @damianslaczka5219
    @damianslaczka5219 6 років тому +1

    These are really great! Thank you!

  • @sauau9588
    @sauau9588 3 роки тому +1

    great

  •  5 років тому +1

    Tremendous tutorials! :D Thanks for sharing!

  • @eugenioremedi7380
    @eugenioremedi7380 5 років тому

    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!

  • @jessebird8825
    @jessebird8825 3 роки тому +1

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

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  3 роки тому

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

  • @NiyazuddinMohammedHyd
    @NiyazuddinMohammedHyd 5 років тому +1

    You are awesome.!!

  • @commieRob
    @commieRob 7 років тому +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.

  • @emthik9615
    @emthik9615 5 років тому

    Great teaching .. thanks

  • @pdmadv1056
    @pdmadv1056 6 років тому

    Wonderful tutorials, thanks!

  • @marcelcharest7662
    @marcelcharest7662 5 років тому +1

    Merci! (Thank you!) from Montréal

  • @vaidiksirsate
    @vaidiksirsate 11 місяців тому

    Great

  • @HariOmJpr3715
    @HariOmJpr3715 2 роки тому

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

  • @masterhenyo7988
    @masterhenyo7988 4 роки тому

    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?

  • @rishirishi4970
    @rishirishi4970 2 роки тому

    Thanks

  • @kerssful
    @kerssful 3 роки тому

    i love it!

  • @krisspinden
    @krisspinden 4 роки тому +1

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

  • @luisforni86
    @luisforni86 3 роки тому

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

  • @vishutomar1706
    @vishutomar1706 3 роки тому

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

  • @Wemyes
    @Wemyes 6 років тому

    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

  • @akankshapandey429
    @akankshapandey429 6 років тому

    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 4 роки тому

    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

  • @cary6652
    @cary6652 3 роки тому

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

  • @DocPosture
    @DocPosture 6 років тому

    2 words... awesomesauce

  • @mrsmoove808
    @mrsmoove808 5 років тому

    smooth coding

  • @GameOverFiles
    @GameOverFiles 2 роки тому

    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  2 роки тому

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

  • @matiasaranda5850
    @matiasaranda5850 4 роки тому

    sos un crack

  • @user-zn5yt7iy1s
    @user-zn5yt7iy1s 9 місяців тому

    Sir can you help with google sheet scripts

  • @singhalmonica
    @singhalmonica 4 роки тому

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

  • @climbeverest
    @climbeverest 5 років тому

    Nice

  • @PaulSmithVPS
    @PaulSmithVPS 5 років тому

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

  • @hecatoplex5506
    @hecatoplex5506 5 років тому

    How do you loop through an array of OverGridImages?

  • @tazulislam2698
    @tazulislam2698 4 роки тому

    Bro! which version are you using?

  • @NamHaVblog
    @NamHaVblog 3 роки тому

    thanks

  • @CreemosEnJesucristo
    @CreemosEnJesucristo 6 років тому

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

  • @pathakullahrabiya7397
    @pathakullahrabiya7397 3 роки тому

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

  • @ernita1264
    @ernita1264 2 роки тому

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

    • @ExcelGoogleSheets
      @ExcelGoogleSheets  2 роки тому

      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 2 роки тому

      @@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  2 роки тому

      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 4 місяці тому

      @@ExcelGoogleSheets very helpfull

  • @emilolorunadeolujoshua1788
    @emilolorunadeolujoshua1788 4 роки тому

    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

    • @sam_safari
      @sam_safari 4 місяці тому

      look on the playlist

  • @TheJPZone
    @TheJPZone 4 роки тому

    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  4 роки тому +1

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

  • @montecristobal
    @montecristobal 6 років тому

    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  6 років тому +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 4 місяці тому

      @@ExcelGoogleSheets interesting explanation

  • @phoenixempire8886
    @phoenixempire8886 4 роки тому

    🙏🏻

  • @siddharthjain6629
    @siddharthjain6629 4 роки тому

    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  4 роки тому

      ua-cam.com/video/985XJOeigpA/v-deo.html

    • @siddharthjain6629
      @siddharthjain6629 4 роки тому

      @@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 4 роки тому

      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 4 місяці тому

      @@siddharthjain6629 u gotta uptade the version of you script

  • @dangkhanhlinh476
    @dangkhanhlinh476 4 роки тому +1

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

  • @nayltonlopes8688
    @nayltonlopes8688 4 роки тому

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

    • @sam_safari
      @sam_safari 4 місяці тому

      you are ready know

  • @trueordrue
    @trueordrue 2 роки тому

    16:33

  • @sam_safari
    @sam_safari 5 місяців тому

    you are ready know

  • @charlesmurray322
    @charlesmurray322 5 років тому

    Has anyone found part 1 of this tutorial ?

  • @shabnambibi2380
    @shabnambibi2380 3 роки тому

    please help me

  • @thebrucecyou
    @thebrucecyou 5 років тому +1

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

    • @sam_safari
      @sam_safari 4 місяці тому

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

  • @matthieuingala9948
    @matthieuingala9948 4 роки тому

    great