I have bill of materials report where the data is double stacked when exported from database.
Original data:

Sheet is very large, but I want to format the data like this

Still a noob with appscript, but how would i script this to do that? Thanks in advance.

