Variable types

Hey guys,

I have an issue after saving the excel sheet and use a variable type IEnumerable I used a use Excel file activity however it’s keep telling me that the variable must be IEnumerable and i need to change it to be IO.fileinfo to be able to use the variable in the use excel file activity.

image

@omar_ismail

I guess your downlodedfile is of ienum of strings.so its like a collection…

If you want to access one then use downloadedfile(0)

Hope this helps

Cheers

Hi @omar_ismail,

I’m assuming that the variable DownloadedFile came from other activity in your code which probably returns a IEnumerable to you.

The first thing you need to do is to work with indexing, meaning: IEnumerable is something like a list, so you need to explicity say in what position is the file that you want to work with. If you are 100% sure that you have only one file, then you could use: DownloadedFile(0) → which gives you first file of the IEnumerable.

You should know which data is in your IEnumerable, since is a IEnumerable of Strings, make sure if the string is not already the path you need. If it is, just to DownloadedFile(0)

If, for any other reason, you still need to use IO.FileInfo, you could convert using:

fileInfoVar = new FileInfo(path), where filoInfoVar is you variable of type FileInfo.

gave me this error

sorry for bothering you again

@omar_ismail

First check the downloadedfile(0) path by using log message…

And also check the task amnager if any excel file is open in background …if so kill it(microsoft excel is what you see)

Lastly try reatarting the system if it still persists

This looks like an excel error

Cheers

Do you have excel installed?

Are you using a file that is sync with oneDrive? If yes, try to copy the file manually to your machine and test it again, just for testing purposes.

Also, it could be a compatibility error, there are some steps you could try:

  1. Open MS Excel (Any File or new file)
  2. Pull up Task Manager
  3. Click on MS Office or Excel Icon in Background Processes, Right click, and select properties
  4. Under Compatibility, Click “Run Compatibility Troubleshooter”
  5. When finished running, test file again, if it works right, click apply settings to this program. If it doesn’t work, click next and choose from the options. (I chose that it worked in previous version of Windows (Windows 7) Then click Next again.
  6. Test file again, and it worked.

https://stackoverflow.com/questions/34246264/automation-error-object-invoked-has-disconnected-from-its-clients

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.