In above Example I want first to use “Hello” then “hi” and Finally “hi” as “Content” for “User Role”. The the output is added to another sheet at the same location.
The problem here is that all of your fields (1, 2, 3, 4) are part of a single row. When reading a sheet, n8n treats each row as a single item.
So in order to run your logic (not just the OpenAI node, but any node) you’d need to add multiple fields to your OpenAI node and then reference your input data using expressions such as {{ $json["1"] }}, {{ $json["2"] }}, etc in each of the message fields.
The bigger problem will be the update. To update a specific row in a Google Sheet through n8n, the row needs a unique identifier. So my suggestion would be to add an ID column of some sort in addition to your existing columns 1, 2, 3 and 4. This would let you use the Update operation of the Google Sheets node.