Run MS Access Query

I have a database that pulls 2 excels in as tables. I created a query between those 2 tables. I want UiPath to run the query, export the results and then email it out to different parties. The emailing of an exported result is simple but I can’t find any good documentation on how to run an MS access query using UiPath.

Any help with be greatly appreciated.

Hi!

See this post:

Hello @atarantino
Refer to this video, you may get some idea.

Thanks but this isn’t were my issue lies. I can connect to the database no problem. I don’t know how to have UiPath execute the existing query and export results to .xlsx.

Ah ok.

Use this activity after having connected to it.
https://docs.uipath.com/activities/other/latest/user-guide/execute-query
The output will be a datatable.

Then write the datatable to an excel with this.
https://docs.uipath.com/activities/other/latest/user-guide/write-range-x

Hello, sorry, i’d like how did u do your executing query process

Thanks I’ll work on this and mark solution if successful.

1 Like

Follow these steps-

To run a Microsoft Access query using UiPath, you can follow these steps:

  1. Install the “System.Data.OleDb” package in UiPath Studio if it is not already installed. This package provides the necessary activities to interact with Microsoft Access databases.
  2. Use the “Connect” activity from the “Database” category to establish a connection to your Microsoft Access database. Provide the connection string, which includes the path to your Access database file, and any other required authentication details.
  3. Use the “Execute Query” activity from the “Database” category to run your query. Input the query as a string, which may include SQL statements and parameters as needed. You can also use variables in the query to pass dynamic values.
  4. Use the “Output Data Table” activity to retrieve the results of the query as a datatable.
  5. Use the datatable as needed in your workflow. For example, you can use the “Write Range” activity to export the datatable to an Excel file for further processing.
  6. If you need to send the exported Excel file as an email attachment, you can use the “Send Outlook Mail Message” or “Send SMTP Mail Message” activity to compose and send the email. Attach the exported Excel file to the email using the appropriate attachment property.