Column Not Found in google sheet

Hii Team,

How can we manage the following

Incase Column Named as ProductNo is Not found then we can assign Blank Value
Else
Assign Value Present in Column ProductNo

Thanks team in advance

Hi @NISHITHA

Your query is quite confusing, could you be more specific.

hello @Sai_chnadrika_Kopparapu

Let me elaborate

Example

If ProductNo this Column is Not Present in Sheet then a blank Value should get assigned to variable

Assign
ProductNoData= ā€œā€

Else If
ProductNo Column is Found in Sheet as below then the Value Present Would get assigned

ProductNo |
12 |

Assign
ProductNoData= row(" ProductNo").tostring

Okay @NISHITHA

Check the below steps,
ā†’ Use the Read Range spreadsheet activity to read the Spreadsheet and store in a datatable called dt_Input.
ā†’ Then use the If condition to check the Column exist in the datatable by using LINQ Expression,

- Condition -> dt_Input.Columns.Cast(Of System.Data.DataColumn)().Any(Function(X) X.ColumnName.Equals("ProductNo"))

ā†’ Inside then block insert the Assign activity and create a variable called ProductNoData to store the first row value by using another LINQ Expression,

- Assign -> ProductNoData = dt_Input.AsEnumerable.Where(Function(X) Not(String.IsNullOrEmpty(X("ProductNo").ToString) AndAlso String.IsNullOrWhiteSpace(X("ProductNo").ToString))).Select(Function(X) X("ProductNo")).FirstOrDefault.ToString

ā†’ In else block insert the another assign activity to give the ProductNoData variable as empty.

Check the below workflow for better understanding,
Main.xaml (12.7 KB)

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.