# I want to search for values extracted from Excel, write them to Excel if they’re not found, and click if they are

**URL:** <https://forum.uipath.com/t/excel-excel/2875445>\
**Category:** フォーラム\
**Created:** [July 3, 2025, 7:39am UTC](https://forum.uipath.com/t/excel-excel/2875445 "2025-07-03T07:39:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![afna](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/afna/32/512761_2.png) [@afna](https://forum.uipath.com/u/afna)\
**Post date:** [July 3, 2025, 7:39am UTC](https://forum.uipath.com/t/excel-excel/2875445/1 "2025-07-03T07:39:19Z")

</div>

Excelから抽出した値を１つずつブラウザアプリに検索にかけて、検索対象が表示されればクリック、表示されなければExcelに記載してクリック動作をスキップという動作を、抽出した値分繰り返すように設定したいです。

現在設定しているフローは以下なのですが、検索結果に対象がない場合、出力された検索結果から対象を探すのに時間がかかっているのと、検索で引っかからなかったものをExcelに記載してくれません。。。  
（検索結果に対象がない場合、出力された検索結果が2件ほどであっても後続処理までに時間がかかってます。）

データテーブルの構築  
追加失敗 string  
変数：dttable2  
…  
↓  
繰り返し（各UI要素）  
繰り返し：現在の要素  
抽出数の制限：最大UI要素数  
項目数：10  
↓  
代入  
target=CurrentRow(currentItem).ToString()  
↓  
トライキャッチ  
トライ  
クリック ※ここは問題なく動作しています。  
キャッチ  
NodeAmbigrousException  
→繰り返し（Excelの各行）  
繰り返し：CurrentRow  
対象範囲：Excel.Sheet(“Sheet2”)  
先頭行をヘッダーとする☑  
→AddDataRow  
列配列：New Object() {target}  
データテーブル：dttable2  
NodeNotFoundException  
→繰り返し（Excelの各行）  
繰り返し：CurrentRow  
対象範囲：Excel.Sheet(“Sheet2”)  
先頭行をヘッダーとする☑  
→AddDataRow  
列配列：New Object() {target}  
データテーブル：dttable2

なかなか分かりにくいかと存じますが、よろしくお願いいたします。

---

<div class="post-metadata">

**Author:** ![SorenB](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sorenb/32/500790_2.png) [@SorenB](https://forum.uipath.com/u/SorenB)\
**Post date:** [July 3, 2025, 8:19am UTC](https://forum.uipath.com/t/excel-excel/2875445/2 "2025-07-03T08:19:44Z")

</div>

Hello @afna

Can you perhaps share a screenshot/file for your current project?

And do you get any error message that we can use to troubleshoot, or does the activities simply not work the way you intended?

Regards  
Soren

---

<div class="post-metadata">

**Author:** ![afna](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/afna/32/512761_2.png) [@afna](https://forum.uipath.com/u/afna)\
**Post date:** [July 4, 2025, 7:21am UTC](https://forum.uipath.com/t/excel-excel/2875445/3 "2025-07-04T07:21:50Z")

</div>

> [@SorenB](#):
>
> Can you perhaps share a screenshot/file for your current project?
> 
> And do you get any error message that we can use to troubleshoot, or does the [activities](https://docs.uipath.com/activities/docs/introduction) simply not work the way you intended?

Thank you for your reply!  
The screenshots are split into two images, but here they are!  
Also, since this is part of a longer workflow, the data table is built outside the screenshots.

 ![A diagram showing a UiPath workflow with conditional branching and looping processes. (AI-generated caption)](https://global.discourse-cdn.com/uipath/original/4X/1/6/c/16c3ce9ee0262a9ab4664bb708b335b0c4a68997.png)  
 ![This image shows a workflow that includes an action to write a data table to Excel and prompt for confirmation in a message box. (AI-generated caption)](https://global.discourse-cdn.com/uipath/original/4X/8/e/5/8e55ad9794718a658b50fe96e7535909a6aa8c0a.png)

It doesn’t work as intended, and I get an error.  
When I say it doesn’t work as intended, I mean that if the search returns multiple results for the item I’m looking for, it moves on to search for the next item without clicking anything or writing anything to Excel.  
Ideally, if multiple results appear, it would click both, but that seems difficult to control, so I want it to write to the “Add Failed” column in Excel, but I can’t get it to work…  
Also, it seems to be searching for the item in the results, but I don’t like that it takes one or two minutes…

I also get an error when there are no matching results. In that case, I get an error like the one below.  
It also seems to take about four minutes…

* * *

22.10.4+Branch.support-v22.10.Sha.b4be88e3b45fb05c4bcd71885c763d4f2095f959

Source: Write Data Table to Excel

Message: The SpecialCells method of the Range class failed.

Exception Type: UiPath.Excel.ExcelException

UiPath.Excel.ExcelException: The SpecialCells method of the Range class failed. —\> System.Runtime.InteropServices.COMException: The SpecialCells method of the Range class failed. at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object providedArgs, ParameterModifier modifiers, CultureInfo culture, String namedParams)  
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Object aArgs, Boolean aArgsIsByRef, Int32 aArgsWrapperTypes, Type aArgsTypes, Type retType)  
at Microsoft.Office.Interop.Excel.Range.SpecialCells(XlCellType Type, Object Value)  
at UiPath.Excel.WorkbookApplication.\<\>c\_\_DisplayClass47\_1.b\_\_1()  
at UiPath.Excel.ExcelContextHelper.Execute[T](Func`1 func, ExcelContext context, Object[] contextParams) --- End of inner exception stack trace --- at UiPath.Excel.ExcelContextHelper.Execute[T](Func`1 func, ExcelContext context, Object contextParams)  
at UiPath.Excel.WorkbookApplication.XlObject[T](Func`1 func, T& excelObject, ExcelContext context, Object contextParameters)  
at UiPath.Excel.WorkbookApplication.EnsureAllCellsAreVisibleOrThrow(DataTable data, Range startRange)  
at UiPath.Excel.WorkbookApplication.WriteRange(String range, DataTable data, Boolean includeHeaders)  
at UiPath.Excel.Activities.Business.WriteRangeX.\<\>c\_\_DisplayClass20\_0.b\_\_0()  
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)  
— End of stack trace from previous location —  
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)  
— End of stack trace from previous location —  
at UiPath.Excel.Activities.Business.WriteRangeX.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)  
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)  
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)  
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)  
— End of stack trace from previous location —  
at UiPath.UIAutomationNext.Activities.NApplicationCard.OnFault(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)  
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)  
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)  
— End of stack trace from previous location —  
at UiPath.UIAutomationNext.Activities.NApplicationCard.OnFault(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)  
at System.Activities.Runtime.FaultCallbackWrapper.Invoke(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)  
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Thank you for your help!!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [July 18, 2025, 8:42am UTC](https://forum.uipath.com/t/excel-excel/2875445/4 "2025-07-18T08:42:50Z")

</div>

Closed on July 18, 2025, 8:42am UTC

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