I tried the suggestion, however, there is a problem that each output item then has the header + Text from previous header (see below).
We will somehow need to split by “:” as well as new line (that’s my understanding). What do you suggest here?
Hey @RahulN , this is a great usecase.
I would agree with @ken.a if you’re able to use the zapier formatter, you should be able to parse and split the message and use it to populate in a spreadsheet.
If you’re good with little bit of coding, you may use such a code to split it in an array and potentially use it in the next step to simply populate that in the sheet. Check this out
Hi @zaki_readylogic, thanks much for your revert. This is helpful and seems to be going the right direction.
I am not a coder but know a bit of it. Hence a very simple and silly question, where does this script go in my zap?
Hi @zaki_readylogic, Please ignore the above.
I have been able to figure out how to run python code in a Zap.
This is the code I am running at the moment.
# Get the message from the input data message = input_datad"Message"]
# Split the message into lines lines = message.split("\n")
# Initialize an empty dictionary to store the data data = {}
# Loop through each line in the lines list for line in lines: # Ignore blank lines if line.strip() == "": continue
# Split the line into key and value at the first occurrence of ":" key, value = line.split(":", 1) # Strip any leading or trailing spaces from the key and value key = key.strip() value = value.strip()
# Check if the key is "Description" if key == "Description": # If the key is "Description", check if there is already a value if "Description" in data: # If there is already a value, append the current line to the existing value datad"Description"] += "\n" + value else: # If there is no existing value, set the current line as the value datad"Description"] = value else: # Add the key-value pair to the data dictionary datadkey] = value
# Initialize an empty list to store the output output = t]
# Append the data dictionary to the output list output.append(data)
However, the issue now I am facing is that the output still gets 1 row instead multiple. If you can help point me in the right direction again.
Hi there @RahulN,
To be fully transparent, our team is able to provide limited support with the Code action step. It's an advanced feature that can involve lots of custom code, and can quickly land outside of our scope of knowledge.
For any questions that I may not be able to answer, I tend to recommend checking these out:
Additionally, we have a directory of Zapier Experts who might be able to help with your code. You can reach our Zapier Experts here:https://zapier.com/experts
Hopefully, this helps.
Thanks for your support till now@ken.a ! I will take a look at the options you suggested.
You are most welcome @RahulN! I’m glad I was able to help you out in some way.
If you have any other questions, please don’t hesitate to reach out to the Community. We’re always happy to help!