cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
DAsogan
Level: Powered On

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
Super User

Re: Excel - Update Row only if the cell is Empty

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!



View solution in original post

5 REPLIES 5
Super User
Super User

Re: Excel - Update Row only if the cell is Empty

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!



DAsogan
Level: Powered On

Re: Excel - Update Row only if the cell is Empty

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?

Super User
Super User

Re: Excel - Update Row only if the cell is Empty

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!



Super User
Super User

Re: Excel - Update Row only if the cell is Empty

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!



View solution in original post

DAsogan
Level: Powered On

Re: Excel - Update Row only if the cell is Empty

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
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,456)