Write Cell: Conversion from string "2.4 SUBSCRIBERS" to type 'Double' is not valid

YT channel opertions2.zip (17.3 KB)

i am unable to remove subscribers word from the column

Hi @Adithyeshwar_goud

You can use the Find\Replace activity to replace the Subscribers with empty.

If the above is not perfect solution, elaborate your query for better understanding.

Hope it helps!!

1 Like

Hi @Adithyeshwar_goud

Try the below way

Excel.Sheet("Sheet2").Range("C2:C"+Excel.Sheet("Sheet2").DataTableValue.RowCount.ToString)

Input:

Output:

sports club responses.xlsx (16.9 KB)

Cheers!!

1 Like

@Adithyeshwar_goud

dt.AsEnumerable()
.Where(row => row.Field(“subscribers”).Contains(“subscribers”))
.ToList()
.ForEach(row => row.SetField(“subscribers”, row.Field(“subscribers”).Replace(“subscribers”, “”)));

Hope it works

1 Like

Hi @Adithyeshwar_goud ,

Find updated code hope it works for you :slight_smile:
YT channel opertions.zip (17.5 KB)

Regards,
Vinit Mhatre

1 Like

Hi @Adithyeshwar_goud

You need to replace the subscribers first and then try to convert the value to double.

→ Use the for each row in data table and give the below assign activities within the for each as shown in below imgae.
use the below in assign activities.

CurrentRow("subscribers") = CurrentRow("subscribers").ToString.ToUpper.Replace("SUBSCRIBERS","").ToString.Trim()

CurrentRow("subscribers") = If(CurrentRow("subscribers") IsNot DBNull.Value, Convert.ToDouble(CurrentRow("subscribers")), 0.0).ToString.Trim()

Main.xaml (13.4 KB)

Regards

1 Like

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