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')
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.
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 ☺️🙏
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.
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?
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 🙏🙏🙏🙏🙏🙏🙏🙏🙏