Transforming Input Data into new sheet with multiple rows

Hi all,

I’m new go coding. I created an app using Zoho with their Deluge language, but I now want to attempt to recreate it in Google Sheets using App Scripts. I believe App Scripts is based on JavaScript.

I’ve had fun creating mini-scripts using some youtube videos that swap columns, filters arrays etc. But there is one conceptual gap missing that I need to plug.

What my app is suppose to do is take rows of of input data with just five columns and create a new table with more rows and columns based on a few simple rules. It’s for bookkeeping so it’s turning transaction data into bookkeeping data.

E.g. one row will have a Date/Description/Category/Amount/Location of a transaction.
This should then be transformed to multiple rows a for double entry bookkeeping:

  1. Date/Description/Category/Amount/Location/Account/Credit/Debit (maybe a row ID too)
  2. Date/Description/Category/Amount/Location/Account/Credit/Debit (maybe a row ID too)
    the one input row would trigger at least two rows in the new sheet whereby one “Account” (say Expense) would be Credited and another “Account” (say revenue) would be Debited.

[the value entered into the new columns would be based on the category in the input data]

So my app would need to
1 Capture the input data into an array
2. Filter the array per category
3. Each category would have a different set of rules, whereby it would create multiple new rows in a new array with additional columns, as above,
4. apply the different rules to different groups of filtered categories
5. write the new data in a new sheet.

The bit I can’t find anything on google searches so far is the creation of multiple new rows, based on the input of one row. So once I filtered for a category, say Expenses, I would want to write at least two new rows to debit one account and credit another.

Can anyone point me to tutorial of some nature that can set me on my path to understanding how to do this?

Many thanks,
Martin