Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Insert a new row in Sheet 2 for each cell in a range in Sheet 1 that is not empty [closed]

$
0
0

Hi I'm new to the Google Sheets App Script and not sure where to start. I'm trying to write a Script that will insert a new row in Sheet 2 for each cell in a range in Sheet 1 that is not empty.

For example, in Sheet 1 range C2:E6, there are 4 cells that are not empty - C2, D3, C4, E4.

enter image description here

In Sheet 2, there should be 4 newly inserted rows with the corresponding Account & Owner column values, and transpose the Product & Quantity values into column C & D.

Sheet 1 - > Sheet 2

Row 2: A2+B2+C1+C2 -> Row 2: A2+B2+C2+D2

Row 3: A3+B3+D1+D3 -> Row 3: A3+B3+C3+D3

Row 4: A4+B4+C1+C4 -> Row 4: A4+B4+C4+D4

Row 4: A4+B4+E1+E4 -> Row 5: A5+B5+C5+D5

enter image description here

As for Row 5&6 in Sheet 1, they don't have cells in the red range that have values so no need to insert new rows in Sheet 2.

Any help would be much appreciated.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>