Choose only excel file

Hi,
I want to extract only excel files and output it content
I try with following process
Main.xaml (23.9 KB)
this is my sample excel file
bb.xlsx (8.1 KB)
my problem is : when I run my process and jest second it stop
how I solve this problem
can you help me?

Get all the excel files into a list and then iterate the loop to extract excel files.

List<String> lstFiles = Directory.GetFiles(folderpath,"*.xlsx")

For Each item in lstFiles
   //Excel Application Scope , pass the file path item.ToString
End For

Regards,
Karthik Byggari

2 Likes

Are you getting any error? and your file is missing references. If you are just using read range activity, it will read the data and close it. so you need to check the rows count or column count to make sure your workflow is reading the data or not?

@Mahesha_Mendis,

In you main.xaml, While getting the directories from the master directory you need to change the search pattern.

You can not filter directories with “*.xlsx” format, that should have a directory with that name.

Example I am filtering the folders starting with “P”.

Directory.GetDirectories("c:\", "p*", SearchOption.TopDirectoryOnly)

Change that and check again.

hi @HareeshMR
without *.xlsx extension specification in the assign part process gives the outpt

I’m confused, I don’t understand what you mean. Could you please explain a bit and paste the screenshots of your workflow that would be helpful to understand

hi @sarathi125
i have bundle of excel sheet with different name with pdf also
then wan to select only excel sheet
then how i achieve it

Yeah got it now, You can use the solution provided by @KarthikByggari in the first reply.

Directory.GetFiles(folderpath,"*.xlsx") which will retrieve the files and assign this to a string array variable and then loop it to iterate through the files.

@HareeshMR
then not hold my process quickly stop :no_mouth:

Then, it is not recognizing any files with the extension .xlsx it seems. Check the output pane if there are errors in the pane

1 Like

@HareeshMR
i have bulk of files in the folder
then i cant specific name

I am not sure but I faced the same issue

My workaround was to:

  • Read all files
  • For each ListString
  • If item.Contains(".pdf")
  • True → MoveReadDelete
  • False → do nothing

I hope this helps @Mahesha_Mendis

Edit: I see that you can’t use Wildcards in reading FilePaths

Here is the solution!
Have a nice day :slight_smile:

1 Like