Add a row automatically - Google Sheet

Hello,

I just started to use n8n and it is amazing, thanks!

I have a Google Sheet scenario that I’m not able to do, maybe someone could help.

Here is the case:

I would like a line to be automatically created above line 2 everyday, that the boxes A2, B2, C2, E2, F2 stay empty, but that the boxes D2 and G2 are filled with the same formulas as the line below.

Do you know if it’s possible to do these 2 actions?

Thanks a lot,
Julien

Hi @julien1, welcome to the community!

This isn’t something n8n can handle well I am afraid. The Google Sheets node only has an “append” operation inserting a new line at the bottom, not an insert above/insert below another row option.

You would essentially need to re-write the entire sheet to move rows around.

Hey @MutedJam

I found a workaround with google Apps Scripts to insert a new line with formulas:
function daily() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh = ss.getSheetByName(“N8N”);
sh.insertRowAfter(1);
sh.getRange(“D2”).setFormula(‘=C2/B2’);
}

But you’re right, I can’t append any data in the blank cases between 2 lines… Do you know how I could do this?

Thanks a lot,
Julien