Add column name in an already existing sheet in Excel.
There are 5 columns in a sheet with data, I want to add 4 more column names beside the already existing columns, ( just column names, No data)
Add column name in an already existing sheet in Excel.
There are 5 columns in a sheet with data, I want to add 4 more column names beside the already existing columns, ( just column names, No data)
You can use Insert Column activity under Excel Process scope.(Modern Experience)
Hope it helps!!
Regards,
Read range the excel file
Take arrayOfString={âColumn Namesâ}
Take for each loop
Add data column activity: In the column name:Give CurrentItem
Hope it helps!!
For workbook activities, use the Add date column activity
For excel activities, use the Insert column activity
For using Insert column activity you have to encapsulate with in excel process scope and use excel file activities.
Hope it helps!!
Use Insert Column activity
In this you can specify the column name after or before you can add.
or use Add Data Column activity
I hope it helps!!
Hello @ayushi_jain3,
By using Modern Excel activity you can insert the column.
Refer this video, you may get some idea.
If you are a classic user, follow this step to get the modern activity.
Hi @lrtetala - Thanks for this. I have a question.
Thanks in advance !
Excel.Sheet(âSheet1â).Range(ââ)
Dont consider Column
In Column Name Mention your ColumnName
If you got the solution for your issue. Please mark it as solution to close the thread.
Regards,
Hii @lrtetala
Itâs giving this error while executing:
"22.10.3+Branch.master.Sha.def2351dc828ccfbcddb6e9e07c9cf71b5bf55da
Could not load file or assembly âUiPath.Excel.Activities, Version=2.16.0.0, Culture=neutral, PublicKeyToken=nullâ. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly âUiPath.Excel.Activities, Version=2.16.0.0, Culture=neutral, PublicKeyToken=nullâ. The system cannot find the file specified. at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|24_0()
at System.Reflection.RuntimeMethodInfo.<get_InvocationFlags>g__LazyCreateInvocationFlags|13_0()
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at System.Activities.ScriptingJitCompiler.CompileExpression(ExpressionToCompile expressionToCompile)
at System.Activities.JitCompilerHelper1.Compile[T](LocationReferenceEnvironment environment, Boolean isLocationReference) at System.Activities.JitCompilerHelper
1.Compile[T](CodeActivityPublicEnvironmentAccessor publicAccessor, Boolean isLocationReference)
at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](String expressionText, CodeActivityPublicEnvironmentAccessor publicAccessor, Boolean isLocationExpression)
at Microsoft.VisualBasic.Activities.VisualBasicValue1.CacheMetadata(CodeActivityMetadata metadata) at System.Activities.CodeActivity
1.OnInternalCacheMetadataExceptResult(Boolean createEmptyBindings)
at System.Activities.Activity1.OnInternalCacheMetadata(Boolean createEmptyBindings) at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList
1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack1& activitiesRemaining, ActivityCallStack parentChain, IList
1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList1& validationErrors) at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList
1& validationErrors)
at System.Activities.WorkflowInspectionServices.GetActivities(Activity activity)+MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at System.Linq.Enumerable.ConcatIterator
1.MoveNext()
at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at System.Linq.Enumerable.SelectEnumerableIterator
2.MoveNext()
at System.Collections.Generic.HashSet1.UnionWith(IEnumerable
1 other)
at System.Collections.Generic.HashSet1..ctor(IEnumerable
1 collection, IEqualityComparer1 comparer) at System.Linq.Enumerable.DistinctIterator
1.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at UiPath.Executor.Tracking.TrackingHelpers.GetVariableNames(Activity activity)
at UiPath.Executor.Tracking.TrackingHelpers.TrackVariables(TrackingProfile profile, WorkflowInfo workflowInfo)
at UiPath.Executor.Tracking.DebugTrackingParticipant.RegisterWorkflow(WorkflowInfo workflowInfo)
at UiPath.Executor.DebuggerPlugin.UiPath.Executor.IDebuggerPlugin.RegisterWorkflowTracking(WorkflowInfo workflowInfo)
at UiPath.Executor.Tracking.WorkflowTracking.RegisterWorkflowTracking(WorkflowInfo workflowInfo)
at UiPath.Executor.WorkflowRuntime.RegisterWorkflow(WorkflowInfo workflowInfo)
at UiPath.Executor.RobotRunner.InitWorkflowApplication()
at UiPath.Executor.RobotRunner.ExecuteJob()
"
The error is file is not found.
Once check the path of excel file.
I hope your error got solved. Try the above one and let me know the status of it.
I am providing the correct path. Donât know why it isnât executing
Can you share the screenshot of error
Test Sequence.xaml (8.1 KB)
Try this:
Use Read Range â Output: inputDataTable
Use the âAdd Data Columnâ activity to add the new columns to the DataTable.
inputDataTable.Columns.Add(âNew Column 1â, GetType(String))
inputDataTable.Columns.Add(âNew Column 2â, GetType(String))
inputDataTable.Columns.Add(âNew Column 3â, GetType(String))
inputDataTable.Columns.Add(âNew Column 4â, GetType(String))
Write Range (inputDataTable) â Specify the same sheet name and range as the original data to overwrite the existing sheet with the new column names.