Database connection as Excel

Hi,

  1. How to connect database in UiPath( which activity I need to use connect Excel as database)
    I need to connect Excel file as database which activity I used to connect this one.

In real-time sceario where will be stored username and password to connect database

  1. In one folder there is n number of PDFs so I want to read pdf name like Shiva.13/01/2024
    How to read the pdf name.

So it will be a 50 gb storage of the pdf like n number of PDFs so if I using loop means it will be difficult to automated the process. Which way is I need to be automated the process without loop.

Hi @siva_sankar

  1. Follow the below YouTube video to connect excel as database.

You need to download UiPath.DataBase.Acitvities package from Manage packages to use Database activities.

  1. You can use the below query to read a PDF without loop.
pdfFiles = Directory.GetFiles("YourFolderPath", "*.pdf")
                        .Where(Function(pdfPath) System.Text.RegularExpressions.Regex.IsMatch(Path.GetFileNameWithoutExtension(pdfPath), "Shiva\.\d{2}\/\d{2}\/\d{4}"))

Hope it helps!!
Regards

Can we tell me the steps of the pdf

Like folder 50 files

Need to filter the file with today date

Without loop

@siva_sankar

Can you specify the date Format

Regards

Date/ month/ year

13/01/2024

1 Like

@siva_sankar
You can try this code:

pdfFiles = Directory.GetFiles("YourFolderPath", "*.pdf")
                        .Where(Function(pdfPath) System.Text.RegularExpressions.Regex.IsMatch(Path.GetFileNameWithoutExtension(pdfPath), "\d{2}\/\d{2}\/\d{4}"))

Regards

Hello @siva_sankar
Try this

Directory.GetFiles("YourFolderPath", "*.pdf").Where(Function(filePath) File.GetCreationTime(filePath).Date = DateTime.Now.Date)    ----> Array of data

Directory.GetFiles("YourFolderPath", "*.pdf").Where(Function(filePath) File.GetCreationTime(filePath).Date = DateTime.Now.Date)(0) ---> To get 1st file