So I have the goal of sending a list of all rows in a google sheet that meet a certain condition as a message in Slack,
So far all is good except for one small formatting annoyance
“COL$B: This is a message COL$C: This is a URL id: 51 row: 51
COL$B: This is a message COL$C: This is a URL id: 103 row: 103”
As you can see the COL$ and the id and row are unnecessary for the message, is there a way in the find replace to use wildcards so I can remove the COL$tcharacter] and the id and row lines?
Page 1 / 1
Hi @JHaynes Thanks for your question!
Could you please show us what your Slack step looks like - specifically, could you take a screenshot of the message field so we can see what’s there? If the screenshot includes private data, don’t forget to obscure that before adding it to your post, thanks!
Hi @Danvers, Thanks for the response,
Here is a screenshot of the output to slack
What I have done so far, grab a list from the googlesheet of all the rows that meet the criteria, Used line item to text because I was getting multiple copies of the same message, And this is what I am left with The goal for the output message is to remove: “COL$B:”, “COL$C”:, the id line, and the row line. The way I removed the COL$A field was by using text replace with nothing, since that line was a static line to begin with
Hi @JHaynes I’m sorry for the delay in getting back to you on this!
Thanks for the screenshot, I can see what you’re saying now. The answer is that there isn’t a shortcut here I’m afraid. You would need to have a Formatter step to remove the text for ‘COL$A’, B and C separately. Sorry about that!
Hi @Danvers,
I was more concerned about removing the ID and Row lines as I could remove the COLA and B C separately no problem but the lines with ID and Row consistently change its not a huge issue in the long run but just a perfectionist within me
Ah, I’m with you. And yes, unfortunately you can’t use wildcards in the replace action.
The only way that I can think to do it would be using a few Formatter/Split Text steps, but that would only work if you had the same number of tasks (rows) each time the Zap fires. Sorry there’s not a better solution here!
Hey @JHaynes and @Danvers - While it might not be possible to do it with a Formatter step, you might want to try the following in a code step and see if it does the trick. The text should be mapped to an input field called “text”.
const { text } = inputData;
const outputLines = t];
text.split("\n").forEach((line) => { if (/^(id|row): \d+/.test(line) === false) { const result = line.replace(/^COL\$.:/g, "").trim(); outputLines.push(result); } });
output = o { text: outputLines.join("\n") } ];
That definitely did the trick in 1 Thanks so much!