Example sheet here

What I want is a Google Appscript that would automatically copy CONTACTS! row to SALES! last row when CONTACTS! row has "SOLD" value in column J **

THe thing is it also needs to create a new row for every "size" on contacts before adding those rows to SALES. EAch size (is sepparated by commas).

The input example is CONTACTS sheet on the example above The expected output is SALES sheet on the example shet above

The only columns that need to be copied are: Name,Size, Model. Under sizes it would write the size which is before - on each value (sepparated by comma).

You can see a final example of how it would look like here after implementing such google app script on sheet CONTACTS!.

I updated three examples for "SOLD" on sheet 'CONTACTS' based on contacts which reflect on sheet 'SALES'this is the expected output as son as you use SOLD on contacts row.

Additional notes: Trigger should be when a new rowunder sheet CONTACTS gets value "SOLD" under column "STATE"

3) the sold line on the contacts sheet should remain there. It should be copied when the state columns gets value SOLD (which only happens once)

Also its not just to copy SOLD row over to the SOLD sheet but also split the rows into multiple rows before copying so if a contact has multiple "sizes" (its a shoe ecomerce store) one size per row will be written under sold. u can see an example of the expected output here given the SOLD contacts under CONTACTS sheet

closed as unclear what you're asking by ale, Rubén, serenesat Sep 11 at 18:30

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Can you provide a new tab SALES2' with expected results ? Looking at your problem i think you can do it without Appscript. To get the size you just need a regex like \dd` if it's always the first 2 number of the value in SIZES column. I'll do an answer if you update/comment and bring some sample datas for the SIZES column . – pjmg Sep 10 at 9:21
  • I updated three examples for "SOLD" on sheet 'CONTACTS' based on contacts whch reflect on sheet 'SALES' docs.google.com/spreadsheets/d/… – sebas Sep 10 at 17:02
  • can you please use appscripts? since the idea is to automatically copyth selected values and format them on the sheet 'sales' – sebas Sep 10 at 17:13
  • @PaulJ did u look at it? – sebas Sep 10 at 18:21