What if data table dont possess all the values for columns?

Hi all,

I have extracted the data from a table present in the web site.
usually this table will have 5 columns with minim of 1 row. n all values filled

but this time i faced a issue it has one row and values are filled only for 3 columns as below

the once which r marked in red has value in yellow usually will have value but this time not there.

and when i did debug
i got it as below, its a scraped data now i took it in to the data table
[Vessel, Port of Loading, Departure Date

I am having a big project. in this i have to take these all 5 values and enter it in excel at different places so i had written the following code.

Well now its throwing an error saying column 4
Cannot find column 4 - from exception i get it as email

NOTE: Let the table have 1 value or 2 values or all the values. i have to enter them in to the excel file. but the above code is not working as expected
Please help me to fix it up


Use IF condition before , to check if the value is null . If not null, assign it asusual . If null, then you can do as required or you can leave empty so that the process won’t stop @Seem


Actually i am having 3 tables
and other tables are having too many columns n n number of rows.

So for each column cell checking with the if conditions, isn’t it tedious???

So i have to check it as follows?

So i have to check it as follows?
if Sailing_Info_DT.Rows(0).Item(3).ToString =null (in if activitity??)


If there’s huge data , then just filter the data out using Filter Data Table activity and then do the process as it is you have @Seem.

That will do the trick

for this how can i use the filter data tbl activiy??

Give the value as column4 and column5 null @Seem



but tomorrow just think if only one column has a value or 2 column has value.
Or no column in all the columns…
this complete project was working end to end , but in that website dont know what changes they have done :frowning:

so you want the data to be filled in all the columns even without a single column is empty?

Hi @Seem

@HareeshMR has the correct approach, if the value empty the row would be removed in the datatable only!!!

If that’s not, I can suggest run a for loop for all empty entries with something as default as “Null” or “Empty”

1 Like


here it is…

which ever columns have values i have to fill it as above. the onces without value in DT . just leave them blank.

But my code which i wrote was thinking all the columns with the values will be present…
so its throwing the error. which i posted above …

now the DT itself is taking only 3 columns or 2 columns based on the values present.

Do these steps

  1. If you have less number of columns, then use IF condition to check if the value is null, if null, leave it blank else write the value


  1. Surround the activities which you used to write with TRY CATCH which will process if the value is not null, else skip the activity