範囲を読み込みアクティビティ(「ExcelReadRange」と「ReadRange」)の処理対象範囲について

範囲を読み込みアクティビティで処理対象となる範囲について、教えてください。

【前提】
読み込み対象のExcelファイルには、2つシートがあるとする。
「Sheet1」…読み込み対象
「Sheet2」…読み込み対象外・不正な形式のURIを含む値が記入されている

【質問】
「ReadRange」アクティビティを使用してExcelファイルを読み込もうとしたところ、
不正な形式のURIが含まれている旨のエラーが発生しました。

同じExcelファイルを対象に「ExcelReadRange」アクティビティで読み込もうとしたところ、
問題なく「Sheet1」の読み込みができました。

ここで疑問なのですが、
「ReadRange」と「ExcelReadRange」では、処理対象となる範囲が異なるのでしょうか?
(「ReadRange」の場合、ワークブック全体が処理対象となり、
「ExcelReadRange」の場合、指定されたシートのみが処理対象となる?)

既出の質問でしたら、申し訳ありません。

Hi @a-k ,

Assuming your question is about Excel Read Range (Modern Activity).

And Read Range Workbook (classic activity)

Both have same functionality, could you please share snap of how you have configured the workbook read range.?

You should be able to mention the sheet name from where you want to read as well .

For your reference attaching a image ,

1 Like

Thank you for your response.

The “ReadRange” activity and the “ExcelReadRange” activity are both classic.
※Both activities are included in the activity package “UiPath.Excel.Activities” (Ver. 2.11.4).
※The modern activity is not used.

The name of the sheet to read from is “Sheet1”.

Sorry, but when I try to upload a snap, I get an error on the UiPath Community Forum screen and cannot share the snap.

Okay can you try configuring and making use of Read Range workbook.?

こんにちは

基本的に処理する仕組みが異なるので同じにはならないです。

ExcelReadRangeの方はエクセルのアプリケーションを通じて処理を行いますので、エクセルで見れる物でしたら基本的には取得可能です。
一方ReadRange(Workbook配下)の場合はClosedXML等の3rdパーティーライブラリを用いてXLSXファイルにアクセスします。例えばコードは以下のようなものになると思いますが(実際にはもっと複雑なことをしていると思いますが)、最初の全体を読み込む時点で不正な情報あるいは認識できない情報が含まれると例外となりますので、そのあたりで落ちているのかもしれません。(実際に以下のコードで試してみても良いかもしれません)

Using wb As New ClosedXML.Excel.XLWorkbook(filename)
Dim ws As ClosedXML.Excel.IXLWorksheet = wb.Worksheet(sheetName)
cellvalue = ws.Cell("A1").Value
End Using
1 Like

ご回答ありがとうございます。
2つのアクティビティは処理する仕組みが異なるとのこと、理解しました。

『「ExcelReadRange」の方は、Excelファイル内に不正な形式の値が記入されていたとしても、
Excelのアプリケーションで開いたときに問題なく見れるのであれば、
Robotでも問題なく範囲の読み込みができる』という認識で、基本的には問題ないでしょうか。

Thank you for your reply.

By “Read Range workbook”, are you referring to the classic activity?

When I use the “ReadRange” activity, I get an error if the Excel file contains a malformed URI.
So I would like to create a workflow using the “ExcelReadRange” activity.

こんにちは

具体的なデータがないので一概には言えませんが、ExcelReadRangeの方はエクセルアプリケーションのファイルオープンに問題がないのであれば、あとは指定範囲へのアクセスになると思いますので、影響がでる可能性は低いと思います。

Yes I referred to the classic activity , as i have attached the sample image as well.

If you want to use excel read range i suggest you to use the modern activities,

Install latest version of UiPath.Excel.Activities
Make use of Excel process scope, in this container’s property you can set the application level settings.

Inside Excel Process Scope, use an ‘Use Excel File’ activity, inside that you can make use of Read Range activity with Excel icon near Read range activity name. Like below.

image

Note : Image copied from google search, just for Activity reference purposes.

Thanks,
Gautham.