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


#1

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.


#2

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


#3

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?

#4

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 : https://www.uipath.com/activities-guide/excel-application-scope

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.

Regards…!!
Aksh


#5

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.

#6

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