Insert data to specific column in excel

Hello!

I want to add data that I have scraped using GetText from a FakeNameGenerator.
I then want to add this data to specific columns in an empty excel file.

         Columns:
           Name         Address         Number

Rows:

I have successfully scraped the data but when I try to insert it to the excel file all the data ends up under the first column. But I want the scraped variable “name” to end up under column Name, variable “address” under column Address etc…

How it looks now:
bild

How do I assign the specific data to each column?

I have created a Data Table using “Build Data Table” and set the columns, after that I tried using a For Each Row with a Write range but it doesn’t work.

2 Likes

Fine
–lets go one by one
–may i know what is the value pass in the add data row activity can i have a view on the property panel with a screenshot if possible
–then use write range outside the for each activity

you were almost done
just we need to check the variable assigned to the column
Cheers @goerris

Hi! Thanks!
I managed to fix the problem by assigning a variable String “arrInfo” to {name, address, personNo}!
bild
bild

I did however come up on another problem after that… Now it inserts triple of the value:

I tried to change the number of iterations on the while loop that scrapes the web site but its still 3 inserts even if I change it. I tried to move the Write Range outside the For Each and the While loop but it still inserts 3 of each values…

After some investigation I see that the ArrayRow is the problem. I changed the Assign arrInfo to only {name, address} which changed the insert number to only two but didn’t fill in the PersonNo column of course…

Any suggestions to what the ArrayRow should be to solve this?

Thanks. @Palaniyappan

We haven’t mentioned the third argument here
That’s why
Cheers @goerris

Hey @goerris
i just want to know one input from your side then i can advice you the flow so you will get the desired output.

Question - the scrapped data is having multiple lines?

Regards.>!!
Aksh

Yes I know! But i get triplets of data when I use {name, address, personNo}, duplicates when i only use {name, address}.

I only want 1 of each person.

Here is a full picture of my sequence :

Thanks for the help @Palaniyappan

2 Likes

Fine
May i know what is the value of that variable arrinfo in for each loop at last
Cheers @goerris

The value is {name, address, personNo}, the variables of the scraping of type String.

@Palaniyappan

No no
The one in for each activity
Like
For each row in arrinfo
So in that what is the value of arrinfo
Cheers @goerris

That is the value! It’s probably wrong I know…

bild

Sorry if I’m misunderstanding

@Palaniyappan

1 Like

Check out the images I posted below your response.

Pasted the whole sequence and the variables I’m using.

Thank you
@aksh1yadav

1 Like

Got it
This will resolve the issue now
—For variable arrinfo change the type in the variable panel as just int32 and default value as 1
—now in the sequence instead of for each loop use a while loop activity and in the condition mention like this
Counter > arrinfo
Where the Counter is a variable or type int32 defined in the variable panel with default value as 0

now Inside the while loop have
—Add datarow as we have now
—Assign activity like this
Counter = Counter + 1

The reason we were having three elements in the array so the loop was iterating for theee times and that why we were getting triplets of value in our datatable

Cheers @goerris

This works, almost…

Now it only adds one person instead…

It only adds the first person that the scraper scrapes in the while loop and the other ones doesn’t get inserted.

bild

@Palaniyappan

1 Like

sorry for the delayed response
let me check once
or
if possible can i have the workflow so that i can look into it
Cheers @goerris

No worries at all! Thanks for helping. Was away on lunch as well…

ScrapeToExcel.xaml (14.8 KB)

@Palaniyappan

Hey @goerris

Sorry was on some urgent call :slight_smile:
image

Try this out -
ScrapeToExcel.xaml (16.6 KB)

Regards…!!
Aksh

Wow! Thank you!
All you had to do was just skip the for each! :smile:

Cheers! @aksh1yadav

Hey @goerris

Yes and Dealy is also playing a role because once you will click on Generate button . webpage takes time to load new data so if you wont use delay then it will scrap the same old user data.

Regards…!!
Aksh

1 Like

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