cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Excel - Update Row only if the cell is Empty

Hello All,

 

I have a flow for an e-mail inbox, and I want it to record the time at which an e-mail message was first replied to.  It's a shared inbox, so we have a policy to always CC or BCC the inbox in the reply so that it effectively e-mails itself when a team member replies. I use this as the trigger, and I have a flow that fills in an Excel table with bits of relevant data on e-mail receipt.

 

My flow currently does this:

 

E-mail Recieved > Initilialize Array Variable > List Rows > Populate Array with ConversationID > Check if the Conversation ID is in the list > If yes, check if it's come from the inbox (i.e. e-mailed itself) > If yes, update Column X in Excel table.

 

So I'm stuck because sometimes there are multiple replies for the e-mail, and presently it always updates and overwrites the data. What I want is the last condition to be 'Update Column X if Column X is empty'. If 'Column X' already has a value, I want it to skip and terminate the Flow.

 

I tried using an if statement, but the flow says it's not valid syntax:

if(empty(item()?['Column X']),triggerBody()?['DateTimeReceived'],item()?['Column X'])

 

How can I perform this logic? Any advice would be greatly appreciated.

 

Not entirely sure if this has been solved before, but I can't find an answer to this so apologies if I have missed it.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User III
Super User III

Hi @DAsogan 

 

Try this expression

 

empty(items('Apply_to_each')?['Name'])
 

Here I am checking column name is empty or not.

 

image.png

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

5 REPLIES 5
Super User III
Super User III

Using expression you can do the following

equals(empty(item()?['Column X']), bool('True'))

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Frequent Visitor

Thanks for the help on the expression.  I think the next problem is that this is returning a value of 'True' when the cell is not empty, which is not correct.  I don't think it's testing the correct cell. Any ideas on how I can make sure it's using the right row?

You might have spaces on certain cells. You could check length expression of that cell to make sure it's returning zero. You may need to use trim as well before using the length.

 

length(trim('columnname')) > 0



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Super User III
Super User III

Hi @DAsogan 

 

Try this expression

 

empty(items('Apply_to_each')?['Name'])
 

Here I am checking column name is empty or not.

 

image.png

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

Frequent Visitor

Hi @abm 

 

Thanks for getting me on the right track! I had missed a step.  Basically, I had forgotten to dump the column into a string variable. now that this is filled, I can do my checks (per your post) and it works.

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Microsoft Ignite

Microsoft Power Platform: 2021 Release Wave 1 Plan

Power Platform release plan for the 2021 release wave 1 describes all new features releasing from April through September 2021.

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (19,402)