Matching file and send mail

Hello,
I have a folder with excel files with name Hyderabad, Bangalore, Delhi etc and I have another excel file which has data with column Hyderabad, Bangalore, Delhi. If excel file in the folder matches with same in column data then I need to send that excel file to mail. How to do this? Please help me with this

Hi @ISBS_ROBOT

Read the Main Excel File using read range & store the output in datatable

  1. Read data in Excel using read range & store output into DataTable (MainDataTable)

Get the list of Excel files from for each file in a folder activity

  1. Get list of Excel files
  2. Extract file name without extension (FileName)
  3. Compare FileName with values in MainDataTable
  4. If match found
    - Send email indicating the match

Hope this helps :slight_smile:

@ISBS_ROBOT

  1. Read Range (Read Excel file with column data into a DataTable)
  2. Assign (Create a list of Excel files in a folder using Directory.GetFiles)
    • excelFiles = Directory.GetFiles("YourFolderPath", "*.xlsx")
  3. For Each (item in excelFiles)
    a. Excel Application Scope (Use this to read each Excel file)
    • Read Range (Read the current Excel file into a DataTable)
      b. For Each Row (row in DataTable from step 3a)
    • If (Condition: row(“ColumnName”).ToString = “Hyderabad” or any other matching condition)
      • Send Outlook Mail Message (or any send smtp mail activity)
        • Attach File (Attach the current Excel file)

Unable to send the mail.

Hi What is the error you are getting while sending email?

@ISBS_ROBOT

Are the names column names or data?

if column names then loop on columns dt.columns and then send email based on it currentitem.columnname will give the name

cheers

Here file names in folder matches with the excel column
New folder.zip (106.5 KB)
UIIC MAIL IDS.xlsx (27.7 KB)
Excel file in the folder should match with the same mentioned in the another excel file and then send the file through mail. Please share the sample workflow.

@ISBS_ROBOT

Refer this

exceltomail.zip (4.4 KB)

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