How To Find Specific Excel File in Folder and Open it Up and Create Pivot Table

Hi,

I am trying to open a specific excel file in a folder (as you can see in my screenshot) where end of the file name will change and then once it opens it up I want to create a pivot table.

File Name: CUSTOM_RWJBH_PB_ProviderGroup_Level_Credentialing_Hold_Report__All_Claims_05282025_04027 - This is the file name but tomorrow the date will be different and so does the time it generates so i just want to do it based on starting of file name.

What is best way to do this? I tried For Each File in Folder and tried inputting the name but it is not finding the file.

Also, say once it does find the file, how can I Use it with the “Use Excel File” activity? What would I enter under “Excdel File” as it is asking for specific file

Hi @nirmit.kansagra

Under for each folder, provide filter as “*.xlsx”

  1. Then inside that for each, use if as below

Currentfile.tostring.contains(“provide here static part of your file name”)

  1. Inside then block, use excel file and provide the file name as currentfile.tostring

This way, you will be able to grab hold of the file you are looking for and then add your excel operations under your excel scope

Thanks so much that worked :smile: !!!



I have another question, when it creates a summary, it creates like below. Essentially all this number is a sum of “Total $ Due” column. Is there anyway to fix the formatting for this AND also is there anyway to make this as currency instead of just spitting the number as it is really currency?

@nirmit.kansagra

  1. Even in filter you can use filename..if you remove .xlsx after * then it would filter
  2. Coming to formatting..not sure how are you using it..instead of using full table while creating mail use only the balue you need and you can just add the value with a prebuilt format in mail..create html content can be used for formatting

Cheers

Hi @nirmit.kansagra

Glad to hear it worked.

How are you writing the total column value in mail at the moment?

Writing the datatable?

Hi @nirmit.kansagra

You can follow below post on same. It has steps on how to add excel data into email body using html content.

Hope this helps.

Regards
Sonali

Basically, I am reading the excel summary tab that gets created and then mapping that to table and then pulling that table in the HTML.

One other question, how can I archive the excel file that I created summary on/found in the folder? Would I use assign activity? I tried that but it looks like I am running into error with BC30512 boolen to string.

For #1 -

The filtering part wasn’t working because the beginning part of the file will be same but the ending part will change every week. Is there an opportunity to still use the Filter By as that would be better if so can you share how you would do that?

CUSTOM_RWJBH_PB_ProviderGroup_Level_Credentialing_Hold_Report__All_Claims - This part would stay the same but at end of this it will change each week to something like this:

Week 1 - CUSTOM_RWJBH_PB_ProviderGroup_Level_Credentialing_Hold_Report__All_Claims_05282025_4382

Week 2 - CUSTOM_RWJBH_PB_ProviderGroup_Level_Credentialing_Hold_Report__All_Claims_06052025_4379

Week 3 - CUSTOM_RWJBH_PB_ProviderGroup_Level_Credentialing_Hold_Report__All_Claims_06122025_3279

For #2 - I will review this thanks.

@nirmit.kansagra

Are you trying to hold the flag that file found or not?

If yes, simply change the type of filefound variable u have created to Boolean under variable pane

@nirmit.kansagra

If you are trying to save the file that was found, simply use filefound = currentfile.tostring

@nirmit.kansagra

"CUSTOM_RWJBH_PB_ProviderGroup_Level_Credentialing_Hold_Report*" - this is what you need to give

cheers