I have a background process which I use “read range” in it.
I cannot use “read range” inside an excel scope, but there is a possibily the file is already opened in another user’s station, so if that happens my background process cannot read the file.
Is there any way to use the activity of “read range” from “workbook” and NOT inside “excel scope” but read it regarding the file being opened in another station.
Welcome to forum
Did u mean u need to use workbook read range when u are using excel application scope read range
Hi, I need to use the workbook read range activity and not the read range inside excel, but I also need to read the file while the file might be already opened.
I know it is possible inside the excel scope, but I can’t use it since it’s a background process and I dont always have excel installed.
I can help you with a 2 solution…
you can use Excel application scope and disable “visible” property in property panel. Which works in the background. Even if file is open no issues.
You can use copy file activity to create duplicate file of excel and then you can use read range activity to ready duplicate file data. Once it is done you can delete the file.
I think, any of this solution might help you with it!!
- If there is no excel app installed in the station that the background process is running on, wont it cause a problem?
- We used this solution up until now but there was a problem with the TEMP folder that we saved the file on, so we tried to think of a new solution which wont make us save the file.
Your scenario looks interesting!!
Even now, i can help you with two high level solution!!
Use VB code to do that and invoke the code in workflow. Which should solve your need. You can have a look at the code by following the link below…
c# - Best /Fastest way to read an Excel Sheet into a DataTable? - Stack Overflow
You can Excel format activity which is available in marketplace to convert your excel file to text file. And then you can read tat text file and use generate datatable activity to covert in form of datatable. Later you can use tat variable in your workflow…
Marketplace activity - Convert Excel Format - RPA Component | UiPath Marketplace
Let me know, which solution you opts in!!
Thank you so much, do you mean using invoke code and then vb.net? im not too farmilier with vb.net, is there any chance you can help me adject the code so it will be used in my workflow? the only thing i need is to read the excel file and put it in a variable in order to use it later in the process.
Please follow the link below to view the code…
And did you try with the second solution provided?
this is the error im getting.
about the 2nd solution i havent treid yet because i really want to make this way work… thanks!
I think, some issue with the code!!
i copied the exact same code as in the link (stack overflaw)
You have to fine tune it based on your requirement!!
hi, i did it but this is the error that i get now when i run it:
this is the full error:
RemoteException wrapping System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> RemoteException wrapping System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle…ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionOpen…ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.Odbc.OdbcConnection.Open() at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) at UiPathCodeRunner_09523e1aa560453984cce035fe2f60b6.Run(String SheetName, String FileName, DataTable& DataTable) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object providedArgs, ParameterModifier modifiers, CultureInfo culture, String namedParams) at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner.Run(Object args) at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.Run(String userCode, List1 inArgs, IEnumerable`1 imps, Object args)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)