Automate row duplication in Google Sheets: Seeking a script to copy selected rows twice

Hey everyone! I’m not a coding whiz, but I use Google Sheets a lot for work. I’ve got this problem where I need to make two copies of each row in my spreadsheets. It’s a task I do pretty often across different sheets.

I tried using the macro recorder, but it only works for the single row I record it on. What I really need is a script or macro that can:

  1. Take all the rows I’ve selected
  2. Insert two blank rows below each one
  3. Copy the content from the original row into these new rows

Is there a way to do this? It would save me so much time! I’m totally lost when it comes to writing scripts, so any help or guidance would be awesome. Thanks in advance!

hey there SoaringEagle! i feel your pain with manual data entry. have you tried using the ARRAYFORMULA function? it can duplicate rows automatically. just put =ARRAYFORMULA(A1:A10) in a new column, and it’ll copy the data twice. might save you some clicks until you find a full script solution!

I encountered a similar issue a while ago and found an approach that required no advanced coding skills. In my case, I manually copied the selected rows and then carefully inserted them into nearby blank rows. This technique, although not fully automatic, helped me avoid errors and was quite efficient for smaller datasets. When dealing with larger sheets or more frequent tasks, developing a custom Google Apps Script becomes more practical. This script-based solution can streamline the process considerably and save time over the long term.

I’ve been in your shoes, SoaringEagle. Manual duplication is a real time-sink. Here’s a workaround I stumbled upon that might help:

Create a helper column next to your data. In the first cell, enter this formula: =ARRAYFORMULA(IF(ROW(A:A)<=COUNTA(A:A)*3, ROUNDUP(ROW(A:A)/3,0), “”))

This will triple your rows automatically. Then use a VLOOKUP or INDEX/MATCH to pull the data into the new rows. It’s not perfect, but it’s a start.

For a more robust solution, you might want to look into Google Apps Script. It has a steeper learning curve, but it’s incredibly powerful for automating tasks like this. There are plenty of tutorials online to get you started.

Hope this helps! Let me know if you need any clarification.