Error when write data into the excel file

Hi all

I have used Data Scraping to extract data on the web and then write into the excel file.

But I have error as below picture… if I change from row(1).ToString to row(2).ToString or row(3).ToString …. then the process is fine.

What is an error and why it happen ?

Thanks you!

Hi,

Check row(1) has any value, may be null.
Always try to use Convert.Tostring(row(1)) this will avoid issues.

1 Like

To write directly into the excel after Data Scraping you can use write range with datatable variable which you got after extraction no need to loop it.

1 Like

@trunghai

What exactly you are trying to achieve?

1 Like

As per your screenshot you are entering row(1).ToString in the SheetNumber field. Recheck with the values in row(1)

1 Like

Hi @sarathi125

Row(1) as below picture… I don’t know what different is in this.

The value in row(1) - you are using as sheet name.
Make sure the sheet exists in your excel file.

Regards,
Karthik Byggari

1 Like

Try removing the range. Leave it as “” .

1 Like

Hi @KarthikByggari

I have used the CSV file as below to search product model on the web, and then write data into the new excel file… the Sheet is created automatically with the name same with model which I search.

Got it.
The problem is in the sheet names you can not use special symbols “/”.

Try replacing “/” with any other letter or with empty.

row(1).ToString.Replace("/","")

Remove special character and it works.

Hi @KarthikByggari

I must be use the Assign activity to remove “/” right ?

row(1) = row(1).ToString.Replace(“/”,“”) ??

@trunghai,

If you want use assign else you can directly pass in Write Range also no problem.

row(1).Tostring.Replace(“/”,“”)

Hi @lakshman

Thanks you for your suggest, but it show a new error as below picture.

Hi,

Print that row(1).Tostring using a writeline activity, I think no value in it.
Thats why I have mentioned to use Convert.Tostring() instead of .Tostring.

Hi @sarathi125

Sorry but i’m not understand clearly your mean.

Could you pls check in my XAML file ?QA - Get data from DMX.xaml (45.1 KB)

Hi,

I have checked and updated. I have added a message boxQA - Get data from DMX.xaml (45.1 KB)
in that just for your understanding. remove it once done with the changes.

Hi @sarathi125

Thank you, I have tried to run your XAML file but the result same before as below.

Hi @KarthikByggari

I have tried to replace with product name without “/” character. But the error still appear when run process.

It very strange!

Thanks you all of you… I have delete old process and create a new one… The result was fine ^^.

1 Like

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