How to Sort Tabs in Google Sheets with Google Apps Script

Поділитися
Вставка
  • Опубліковано 28 лис 2024

КОМЕНТАРІ • 24

  • @Saveturtlessavetheplanet
    @Saveturtlessavetheplanet Місяць тому +1

    This was my first time using App Script ever and it worked perfectly. Thank you so much for the great tutorial!!! Lifesaver

    • @yagisanatode
      @yagisanatode  Місяць тому

      Fantastic to hear! Happy coding!

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

    Thank you so much for this tutorial & script. Made my life so much easier.

  • @LyanneDiaz-x9e
    @LyanneDiaz-x9e 29 днів тому +1

    Amazing. Thank you. It worked!

  • @MarikoJakins
    @MarikoJakins 9 місяців тому +1

    Thank you, thank you, thank you! I've been manually alphabetizing my tabs and it was taking way too long. This was easy to understand and do.

  • @LeadingLadiesLoriFlores
    @LeadingLadiesLoriFlores Рік тому +2

    I tried and tried to get it on my own and could not, your help sheet was a life send for sorting my 46 tab sheet! Thank you!

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

    Thank you. This was very helpful. I also had to be very mindful to be exact. Are you able to use the same script file to order another file - or do you need to open the google sheet and copy the code into the AppsScript for each file?

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

      Yes you can order any range in other Google Sheets files. You can do this from a core script bound to say, a Google Sheet, or using a standalone script.
      You could even create core Sheet to add your other Sheet URLs to and run a daily time trigger to update them.

  • @temyraverdana6421
    @temyraverdana6421 Рік тому +1

    Thanks a tot, great lesson.
    Do you think possible apply sort function at all the tabs except the first two tabs or at a number I decide?
    Thanks and see you next

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

      No problem. Yes, you could use a for loop to start your iteration at the desired index or use the filter method to exclude any specific tabs that you don't want included.

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

      @@yagisanatode Thanks for answer, very useful

  • @ramzidjauhari7575
    @ramzidjauhari7575 Рік тому +1

    Scott… nice video… can we protect the order of the tabs using appscript? Thank you.

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

      Thanks. Not directly unfortunately. Your best bet here is look at the onOpen() trigger function to reorder your tabs to their original position each time the Google Sheet is opened. developers.google.com/apps-script/guides/triggers#onopene

    • @ramzidjauhari7575
      @ramzidjauhari7575 Рік тому +1

      @@yagisanatode sounds reasonable. I’ll try it. Thanks Scott.

  • @jenniferblanchard494
    @jenniferblanchard494 26 днів тому

    My message is saying TypeError: ss.getSheets is not a function Please help

    • @yagisanatode
      @yagisanatode  26 днів тому

      What does your `const ss` variable look like?

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

    hey let's say I have 5 columns and there all filled with names but I want to alphabetize them all so that A1 would be like Adam and E30 would be zebra and all the names in between would sort accordingly Hopefully that made sense Also completely different question lets say I have a name in A1 and then I have a picture in A2 how do I lock these cell together so when do use the answer from the first question they are always together

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

    I am curious if you know a work around for a bug flagged: ui: undefined while following your steps in the video. The extra menu option do not show up.
    Code:
    function onOpen(){
    const ui = SpreedsheetApp.getUi();
    ui
    .createMenu("Extras")
    .addItem("Sort Tab Asc", "tabSorter.ascending")
    .addItem("Sort Tab Desc", "tabSorter.desending")
    .addToUi();
    };
    const tabStarter = {
    ascending: function(){ this.sortTabs(true)},
    decending: function(){ this.sortTabs(false)},
    /**
    * Naturally sort tabs.
    * Sparam {boolean} inAscending - if true, then sort ascending, false sort descending
    */
    sortTabs: function(inAscending){
    SpreedsheetApp.getUi().alert("Is ascending: " + inAscending)
    }
    }
    Thank you for your help if you've for time.

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

      Hi! A couple of things I noticed.
      Change "Spreedsheet" to "Spreadsheet"

    • @rorykramer9477
      @rorykramer9477 Рік тому +1

      @@yagisanatode oh my gosh thank you for showing me what went wrong!