Two Variable save in one excel sheet

Hi. i am a new to the UiPath tool i just confuses here how can i give the two variables for two diff columns having same excel sheet?? please try to guide me here so can i lear and explore more…do needfull!!!

Hi,

I don’t clearly understand the question. Do you mean both columns in excel have the same name?

If that’s the case you could use Build Data Table to define your table schema.

Alternatively, you could exclude the headers when reading the table and reference the column numbers.

In any case, please elaborate a little bit more so we could provide a more accurate recommendation. Feel free to include screenshots.

You can read the excel
Than you can iterate the data table by column
And inside the that for loop while iterating column you store the result into collection variable for the two column

Hi @ Botzilla i just stuck at the point i can extracting the files thru read range and use wrute range workbook activity to save in another excel … but the all the data was overwritten in same row i tried multiple attempts can u pls suggest here once

Hi thanks for ur reply… can u please ellaborate so that i can go with my scenario… i just want to get the excel file name which was in folder … have to get the excel file name and date which was be save into excel with their corresponding “processing report file name” and “Report Date” columns!!! can u please suggest here i tried a lot with to give two or more variables and got stuck at this moment!!!

You can use get files activity for the mentioned location and use for each loop to iterate all the files.

Then you can use build data table activity with the two column you want

Now inside for each loop
Use Get file info activity
And by this you can get file name and time. Pass this two values to data table using add data to collection

After for each loop once you table is ready

You can use write range to store the result

hey … hi i just want to call the only excel files without overall the folder…

Hi still hit by the error!! Can u please give more in detailed so i can learn and explore from it

Yes but get folder will create collection of file and that file name you can pass to get info
It will solve your this error @farzana.mohammed

The str file path what is the value you are passing there ?

HI @farzana.mohammed I have attached Xaml file with the reference code. You need to pass the value of the folder path in variable filepath. While pass the value keep the format as below. The last back slash is imp do not miss it.
"C:\User\Desktop\Files"

Hope this helps :slight_smile:
Main.xaml (12.7 KB)

Have you tried using Append range instead of write range, if there is no special manipulation in your dataset append should write exactly at the next empty row without overwriting.

Annother point of view:

I’m assuming you’re using Read range to determine how many rows are on your excel file, in that case try this

  • Read range as you’re currently doing
  • Assign dt_Summary.RowCount to Row_Count
  • Increase Row_Count by 1
  • Set your write range to “C”+Row_Count.ToString

Hi Edwin,
i tired multiple attempts data was extracting from multiple files to the variable dt_summary but it was overwritten to the same column its not going to the next column can u once suggest here again!! and correct me once!!

Hi
Thankyou for ur reply i tried it but not get the point i just confused there can u please ellaborate it in more detail…i have to extract the name and date of excel files which was shown in screen shot and have to save the particular another excel having two sheets(Succes,Failed) at the particular column A and Column B…please give more detail so that i can easily understand and get the point… Do needfull … thanks :slightly_smiling_face:

I have shared the code in my previous reply
You can use it @farzana.mohammed let me know in case any clarification required in code

I have updated entries in one sheet
As was not clear with the requirement of updating them in two sheets

But while updating u can add logic based o. What it choosing which sheet to update

Add if logic. And initialise two data table abased on logic u update either table and in the end have two write range activity for two tables
It will solve

@farzana.mohammed see this reply I have attached sample code here