Insert to new created sheet

Hi,

I have a question: Could I create a new Sheet in a spreadsheet and then Update (insert some rows) to that sheet?
As I realized in [Resource] - Sheet , [Operation] - Create , I can create a new sheet, But I couldn’t figure it out how to insert some rows into that created sheet!

Is it possible?

My version: 0.222.1

Hi @jellybean :wave:

Just to make sure I’m following, are you looking to add some columns with content? If so, it sounds like you’d be looking for Append Row, like this:

You’re also on quite an old version of n8n - I’d recommend updating if you can :bowing_man:

1 Like

Great, Thanks @EmeraldHerald , This resource - Sheet Within Document - didn’t exist in my already-added google sheet node, I added a new one and it has this option now :slight_smile:

I realized that if I set Data Mode to Auto-Map Input Data to Columns I can add a row using Set or Code nodes, but How can I insert multiple rows at once?

For example if I write this code in Code node,

return {
ID: [“12”, “13”, “14”],
Label: [“Test1”, “test2”, “Test3”],
}

The result would be:
image

Hi Everyone,
I still have problem to insert multiple rows at once in google spreadsheet. Is there any solution for it?

Regards

Hi @jellybean - sorry that you weren’t replied to earlier!

I think this is because you’re using the incorrect data structure here - these should all be their own object with an ID and a Label. Can you try something like this?

[
  {
    "id": "12",
    "label": "Test1"
  },
  {
    "id": "13",
    "label": "test2"
  },
  {
    "id": "14",
    "label": "Test3"
  }
]

2 Likes

Hi @EmeraldHerald , No problem :slight_smile:

Thanks for you reply and your help.
No success :frowning:

Please take a look at the screenshots:

image

As you can see, the Code node returns an array of objects (containing id and label)
And the sheet itself contains id and label. The google sheet node returns no error!
But the spreadsheet doesn’t get updated.

Also I tried with single item like this:

return [
  {
    "id": "12",
    "label": "Test1"
  },
]

But no any success.

Do you have any idea what’s going on here?

Hi @jellybean :wave: Does this still happen if you manually map the columns? I’m wondering if any fields either in n8n or in your Google sheet have whitespaces, which wouldn’t find the correct column through auto-map if whitespaces exist :thinking:

Hey @EmeraldHerald,
It seems the problem was my sheet, Now It’s fixed
Thank you very much

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.