Extracting blank cell from Excel file

When I extract data from an excel it works fine if the cell has data but when I extract a blank cell it returns “A” 2, as an example, which is the actual cell row/column. Is it possible to extract a cell and actually have it show as , meaning if the cell is empty I want to extract it as empty? Or is it possible to have an IF activity to not extract if the excel cell is ? Currently I am extracting from one excel to another where I only want certain data points whether it has populated data or not.

Are you using the read cell activity or read range?

incase of a read range: your condition inside an if should be:
Not String.IsNullOrWhiteSpace(row("ColumnName").ToString.Trim)

Read cell:
Not String.IsNullOrEmpty(yourStringVariable)

I’m currently using a Get Text activity

in that case, use an if activity and your condition could be

Not String.IsNullOrEmpty(OutputVarFromGetTextActivity)

so if the variable is empty this will go to the Else part.

and just to be safe, maybe use this:

Not String.IsNullOrEmpty(OutputVarFromGetTextActivity) Or Not String.IsNullOrWhiteSpace(OutputVarFromGetTextActivity)

to add there’s about 40+ fields being extracted and either one can be blank at any time, is there a better solution or is it best to create an IF activity for each Get Text?

I dont see a different way, you can have one if with condition checking for all of them thats if one of them is empty you want to not continue otherwise you need an if for each.

You can just create a loop, and a list variable to append each variable from each get text activity and then use a loop to go through each of them and check if its empty

Thank you!

1 Like

@shdacak - you can try adding that 40+ plus fields in the datatable and using for each activity you can read each row and check the condition provided by @SenzoD

When I use Not String.IsNullorEmpty it pulls the blank correctly, but if on the next loop that same field on a different Excel has data it still pulls blank. I also tried String.isNullorEmpty which pulls the data but if it’s blank it shows as “A” 2

Tried this?

When I use the above condition it returns the values as if there was no condition. Cell with data pulls as is and Cell with no data pulls “A” 2

Is there any reason why you’re using “get text” instead of “read cell” or a “read range” activity? I don’t think “get text” is an appropriate use for this situation and may resolve your problem - “read cell” will just return an empty string which seems to be exactly what you’d like?

I ended up using a “Write Cell” instead, I was originally using Get Text because it involved grabbing data from an excel and from a separate data page.