Open an excel file and then add some data to it?

I just need to open one new excel file and populate the contents into it. I see only close workbook option and no open option. I just need to open one new excel file and populate the contents into it.

excel application scope to open excel
write cell/range to add some data

1 Like

Thanks @ddpadil. But I am using excel application scope in my code. If there is no excel with the same name it will create the file in some location.
My questions are:

  1. how is the location of the newly created file decided by uipath (If I havent mentioned any file path) ?
  2. though the new excel is created, it still doesnt open. is there any other command for it?

Bydefault the default workflow directory from where your workflow is running.

It Deals with excel in the background and if you wants to see that excel is opening or not then you can check the visible property in excel scope properties but for some seconds it will show and then close it.

Follow this link : Activities

but best for you to use excel application scope with read range then it wil return its data into a datatable then you can perform operations on that data as per your need.


Looks like @aksh1yadav gave u all the info. :slight_smile:
adding to that regards to your first qn. if you don’t know which file its created or some dynamic changes in the file name then you can do the following steps.

  1. assign variable file=directory.getfile(“path name”)
    2.use Foreach to iterate through each item inside the folder
    3.Inside Foreach you need to use "excel application scope" and pass the item in the “Workbook path” this will read the dynamic files.

Thanks for the help @aksh1yadav and @ddpadil. Going to try them… :slight_smile: