Variable name

Hello

Could you please help me?

I have a file whose name is variable according to the hour, minute and seconds, how can I read its data?
Example file name: load_parada_todaseclusas_jessica.c.silva@dhl.com_03-03-2020_095518.xls

1 Like

Hi LucasSilva. Are you just looking to read the contents of the excel file with that name stored in the variable?

1 Like

i want to read the data from this file and paste it into another file in excel

1 Like

Are those files inside a folder in your machine? If they are, then you can use Directory.GetFiles(“c:\folder”) and assign it to a String Array variable, after you can use For Each activity to read the files.

1 Like

Ok no problem. You basically need to use an Excel Application Scope activity. In the workbook path, pass in the full path of the excel file. Then use an read range activty to output the content of excel sheet into a data table. So call the output of the activity something like outDT. Then you use a for each row activty to cycle through the contents of the outDT datatable. In order to place the excel contents into another excel file. You can use the wrtie csv activity. This basically takes the outDT as an input and it will output an excel file.

1 Like

the file I will need to download every day so the name will change every day.

Hello,
yes the file is on my machine is just a file.
It seems to me a great solution but I don’t know how to execute it

do you need a specific date? You can use asterisk(*) to have a greedy search for all the files

Directory.GetFiles(InputFolderPath,“load_parada_todaseclusas_jessica.c.silva@dhl.com_*.xls” ,SearchOption.AllDirectories)

1 Like

Ah I see now buddy. I misunderstood the varibale part. Try this workflow. Excel.xaml (7.0 KB)

Basically place the excel file into a folder of your choice. Update the folder path string variable with your folder path. The next part is setting up a string array called files which will get all the files in that folder. I am then taking the first file in that folder and storing it as a string which can then be passed the excel scope activity and carry out the next process.

I hope this helps. :slight_smile:

1 Like

Thank you very much it worked perfectly

1 Like

No problem man. Happy to help :slight_smile:

1 Like

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