Text with line breaks into Google Sheets cell?

I have a few lines of text I want to send into sheets as a numbered list, one under the other, into a single cell. How to format? Is it possible?

Information on your n8n setup

1.7.1 cloud

Hi @blueberry, this certainly is possible, but the exact approach would depend on how your data looks like. Perhaps you can share the JSON data you currently have for a closer look?

As a very general suggestion, and assuming you have multiple items in n8n which you want to write into a single cell, this is what you could do:

This will merge concatenate items in a single array using the Item Lists node, then join each array item using the newline character. The remaining single item is then added to Google Sheets, producing the following result:

1 Like

Thanks @MutedJam , I looked at it and I see my problem now. My json is generated by chatgpt, and the numbered lines of text are not getting separately recognized as an array:

“content”: “[ “1. text”, “2. text”, “3. text”, “4. text”, “5. text” ]”

I will have to look for a function to turn this into array that I can .join(‘\n’)

1 Like

or of course I should have just asked gpt to format it correctly :sweat_smile:

1 Like

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