Open files with filename in Excel

Hello. I am having problems with opening the files “.gz". So I want to ask people to help me with this problem.
First, I printed all the filenames in a excel. Then I want to open each file up to work. If 1 files is successfully opened, the column “Status” to it will mark (for example: “OK”). After opening, work with that file->close files->open the second file. Repeat until you’re done with all the files. Since I don’t have "
.gz” files available on my lap, I took the example with “*.txt” files so that people could understand.

I guess the easiest way is to do a for each loop for the excel then take every row’s data to execute your task which is opening the files. Once its done, you could use that filename again and look for the name in Excel file again, if found then update the column Status.

1 Like

Thanks for the reply. Every time I run the program I have about 300 files. I pasted all the files into excel files but the problem is that when I opened it, uipath opened all the files. If 300 files are opened at the same time, the computer cannot be loaded. So I want to open each file, work, close the files and open the next file

Use Directory.GetFiles to get an array of all the files. Then use a For Each to loop through the files.

thank you but can you give me an example?




Lop take files in folder, paste all files names into excel files I did already. But what I need is that when using the loop to open files, you can open each file, not open the whole thing. Thanks

You put those steps inside the For Each. “item” represents the current file in the loop.

For Each…

  • open file (item)
  • steps to process file
  • close file/application the file opened in

//For Each

1 Like

thank you!

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