Google Sheets - Loop Macro Through All Worksheets - Apps Script

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

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

  • @McEArt
    @McEArt 11 месяцев назад

    Thanks! Your videos have made my new business so much ease!

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

    Brilliant!!! Can't thank you enough! You just saved me a lot of time!

  • @faisal-ca
    @faisal-ca 3 года назад

    Thank you very much. This is exactly what I was looking for and it worked like magic.

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

    This is brilliant. WYSIWYG then code editing. No more or way less looking around online for syntax tips.

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

    Thank you very much

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

    Nice video. I was just wondering on the last row part, why not just take out the 19 all together as that will go to the last row itself instead of adding more code (At least for this example)? (example: ('A6:C')

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

    awesome! just one thing i would ask. how about if more sheets to be excluded?

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

    YOU SOLVE MY WHOLT PROBLEM THANKS

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

    Thank you!!!

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

    Thanks a lot. It would be great if the code should start the loop from the current active sheet, it would be easier to use it anywhere

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

    Hi, this is the lesson I've been looking for! How do we exclude more worksheets?

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

      The following AppsScript inserts a new row above row 12 and copies the formula from row 13 and pastes in the new row 11 that was created for Sheet 1 & Sheet 2, you can modify the section "var tabs =[ ]" to include all the sheets where you need your script to be executed taking care to use the correct sheet names. The rest of the sheets in the spreadsheet remain unaffected.
      function addNewRow() {
      var tabs = [
      'Sheet 1',
      'Sheet 2',
      ];
      var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
      for (var i = 0; i < tabs.length; i++) {
      spreadsheet.setActiveSheet(spreadsheet.getSheetByName(tabs[i]), true);
      spreadsheet.getRange('12:12').activate();
      spreadsheet.getActiveSheet().insertRowsBefore(spreadsheet.getActiveRange().getRow(), 1);
      spreadsheet.getActiveRange().offset(0, 0, 1, spreadsheet.getActiveRange().getNumColumns()).activate();
      spreadsheet.setActiveSheet(spreadsheet.getSheetByName(tabs[i]), true);
      spreadsheet.getRange('13:13').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
      }
      }
      Hope this helps. Of course you need to modify the rest of the script to suit your requirement. Let me know if it works for you.

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

    hi, is there a way to apply the macro to a listed sheet name? thanks

  • @RydenStone-s8w
    @RydenStone-s8w 21 день назад

    Nice

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

    i cant figure out a way to add a macro to all my other spreadsheets can u help me with that?
    so i get a repeated dataset everyday but each in a new sheet so how do i add that macro to all my other sheets?

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

    Hello I've done what you show in the video but it doesnt want to skip the sheet I've selected to not execute the macro on it

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

      What's your code?

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

      @@ExcelGoogleSheets
      Thank you for your quick response
      I just forget to put the () on a function 👍

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

      👍

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

    You are great

  • @4thfolio292
    @4thfolio292 2 года назад

    Thank you so much, just wanna ask, what if, you only want selected sheets to be part of your loop macros? Instead of (var allsheets) what should I put? Looking forward for your reply ☺️🙏

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

      Given that selecting several sheets was recently introduced, I don't think it made it as a part of Apps Script API yet. So as far as I know, at the moment you can only get the sheet which is currently active & that's it.

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

      I would use the logic in this video with checkboxes as a workaround ruclips.net/video/P0L2K7AXufw/видео.html

    • @4thfolio292
      @4thfolio292 2 года назад

      Thank you for response

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

    Excelent!!

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

    Thank you

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

    Can you use the same script to the new worksheet?

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

    Google sheets seems more amazing than Excel by using JavaScript instead of VBA

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

      in what way?

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

      Microsoft is well aware of this which is why they are trying to push everyone off of VBA to their own version of Javascript (typeScript).

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

      @@amitk2784 not as compatable. Particularly on web and mobile phones.

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

      @@srider33 typescript is not intended for what you said. It's for a different purpose .

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

    sir i'm trying to record macro in google sheets. But while recording it showing "activating previous sheet" rather than activating named sheet. and paste data anywhere without any command.kindly make latest video to solve my problem to record macro in google sheets
    🙏🙏🙏🙏🙏🙏🙏🙏🙏

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

    good

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

    Thanks

  • @uzomasochukwuuchechukwu-ag5525
    @uzomasochukwuuchechukwu-ag5525 2 года назад

    How can i ignore multiple sheets with this your formula, this is urgent, thank you