I want to insert the rows from an existing data extension with the same column structure into another one using SSJS within Automation-Studio. I am using SSJS because I want to add them dynamically, where SQL cannot be a solution because you have to select the target Data-Extension manually.
So first I tried to select the DataExtension and add its rows into another DataExtension using the following code:
<script runat="server">
Platform.Load("core", "1");
var submitsDe = DataExtension.Init("xxxxx-xxxx-xxxxx-xxx-xxxxxxxxx")
var data = submitsDe.Rows.Retrieve(); // Get all rows from source DE as Array
var anotherDe = DataExtension.Init("another_de")
anotherDe.Rows.Add(data) // This should work because Add() function also accepts array of objects source: https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/ssjs_dataExtensionRowsAdd.html
</script>
I added this script to my data automation and ran it and it also says that it ran successfully, but the new data extension did not add any new rows. I have also tried to debug the code by testing it within a cloud page to see if I really get an array of objects with all the record entries from the "submitsDe" table.
So the code is executed but I don't see any result. Is there any other way to debug the code if there is no other solution?
Thank you in advance!