Link to home
Start Free TrialLog in
Avatar of xenium
xenium

asked on

Google script to append data to google sheet

hi,

I'm looking to copy the contents of one google sheet, and append this to another sheet.

Example: https://docs.google.com/spreadsheets/d/1ImfmePjRiEdFW_JMs9fgH9D8UujEa8rbbXm1eOIHc10

Task is to copy the contents of sheet "input" to sheet "output". The expected result is shown in sheet "output after append".

The script needs to work for any dimension dataset, and both "input" and "output" will have the same column headings.

Any help much appreciated, thanks!
Avatar of abbas abdulla
abbas abdulla
Flag of Bahrain image

You can do this using formula check this function:
=ARRAYFORMULA(query({output!A:C;input!A:C},"where Col1>0"))
You can add order by to the function to sort the results
=ARRAYFORMULA(query({output!A:C;input!A:C},"where Col1>0 order by Col1"))
Avatar of xenium
xenium

ASKER

Sorry, i should have given more info: I need to copy the data as values, not using a formula.

Reason: the input will be formula based. The output is to save the data as values.
You can copy from formula and paste as values.
SOLUTION
Avatar of abbas abdulla
abbas abdulla
Flag of Bahrain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xenium

ASKER

Yes, I'm looking for a script to do it.

Reason: this step will be repeated over various iterations which will also be automated
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xenium

ASKER

The script I wrote does the job. I did not use the link from Abbas but i suspect that it provides an alternative.

Thanks all