# Excelでフィルターをかけた状態で範囲を読み込んで件数ゼロだった場合の処理

**URL:** <https://forum.uipath.com/t/excel/522665>\
**Category:** フォーラム\
**Tags:** datatable, question, studio, excel, activities\
**Created:** [March 3, 2023, 7:07am UTC](https://forum.uipath.com/t/excel/522665 "2023-03-03T07:07:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![s-ito](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/s-ito/32/176817_2.png) [@s-ito](https://forum.uipath.com/u/s-ito)\
**Post date:** [March 3, 2023, 7:07am UTC](https://forum.uipath.com/t/excel/522665/1 "2023-03-03T07:07:41Z")

</div>

指定した値でフィルターをかけてから範囲を読み込み、表示されている行の件数をログしたいです。（ヘッダーは含まない）  
1件以上ある場合は問題ないのですが、0件の場合「範囲を読み込み: A column named ‘0’ already belongs to this DataTable.」というエラーがでます。  
「0件」とログするための方法はありますか？

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [March 3, 2023, 7:18am UTC](https://forum.uipath.com/t/excel/522665/2 "2023-03-03T07:18:53Z")

</div>

> [@s-ito](#):
>
> 0件の場合「範囲を読み込み: A column named ‘0’ already belongs to this DataTable.」というエラーがでます。

最も単純には、Try-Catchで囲って、当該エラーを捕捉、キャッチで0件の情報を代入してあげるとよいかと思います。  
他の方法もあるかと思いますが、もし可能ならダミーでも良いので、対象のファイルや現在のワークフローを共有いただくと良いかと思います。

---

<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:** [March 7, 2023, 1:59am UTC](https://forum.uipath.com/t/excel/522665/3 "2023-03-07T01:59:14Z")

</div>

Closed on March 7, 2023, 1:59am UTC

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