How to read data from excel then create table in sql database using excel column of excel file & insert data into that table

Hi guys. please help me with example on followings.

  1. Read tabular data from excel file
  2. create table in sql database based on the excel file column names
  3. & finaly insert these data into sql data table

Thanks

Hi @Kamal007,

Are you trying to insert the data to a sql database? If so you will first need to install the appropriate driver to connect to the database. Once that is done, you can follow the below steps.

  1. Add UiPath.Database.Activities to your UiPath solution through package manager.
  2. Add a Read Range to read your excel to a datatable
  3. Use the database connection activity and create the connection to the database
  4. Use a for each row activity to loop through the datatable
  5. Within the loop, use the execute query activity.
  6. Configure this activity to accept the datarow returned from the row variable of the for each row.
  7. Write the query to insert it into your table

Regards,
Neelima.

So I assume you have completed the first step already and you have a datatable.

Now you need to build an sql create table script based off of the column names / data types (unless they can all be nvarchar etc).

That needs to then be run using a non query activity.

Once you have created the table, you can then either loop through each row and use a non query to insert your data by writing a template sql and replacing your values in the string.

Or try insert datatable activity.