afna
(afna)
May 2, 2025, 11:01am
1
Excelのデータを取得したい列に記載された情報をそれぞれ変数に格納したいです。
その場合は繰り返しアクティビティを使用するかと思うのですが、繰り返し数は毎回変動するのでどのように設定したらよいでしょうか。
また、繰り返しアクティビティの「次のコレクション内の各要素」は何に設定したらよいでしょうか。
以下用件となります。
出力されたExcelファイルには、毎回出力されるデータの個数が異なります。
しかし、取得したいデータの列はわかっています。
想定フロー
・Excelファイルを使用アクティビティ
↓
・繰り返し(コレクションの各要素)アクティビティ
↓
・セルの値を読み込みアクティビティ
よろしくお願いいたします。
singh_sumit
(Sumit Singh Tariyal)
May 2, 2025, 11:07am
2
Hey @afna if i’m not wrong your are reading some excel file then save in the dt (datatable ) variable now you are doing the iteration to read all the values from the multiple column and store the columns data in multiple assign .
so you can use for each row activity inside the for each use assign activity on the required num of columns data you want - like 3,5
so inside the for each loop drag 1 assign activity
in the left hand side create the variable and in the right side use currentrow(“yourcolname”).tostring
that way you can store the datas
cheers
afna
(afna)
May 2, 2025, 11:18am
3
singh_sumit:
Hey @afna if i’m not wrong your are reading some excel file then save in the dt (datatable ) variable now you are doing the iteration to read all the values from the multiple column and store the columns data in multiple assign .
so you can use for each row activity inside the for each use assign activity on the required num of columns data you want - like 3,5
so inside the for each loop drag 1 assign activity
in the left hand side create the variable and in the right side use currentrow(“yourcolname”).tostring
that way you can store the datas
cheers
singh_sumit さん
お返事いただきましてありがとうございます。
言葉足らずですみません。
複数のExcelファイルからではなく、一つのExcelファイルから特定の列(Q列)の情報を変数で格納して、後続フローでQ列のそれぞれのセル(Q2,Q3…)の値を別々で入力したいのです。
また、追加となってしまい恐縮ですが、Q1のデータは取得してほしくないのものです。
よろしくお願いいたします。
singh_sumit
(Sumit Singh Tariyal)
May 2, 2025, 11:25am
4
Hey @afna is Q1 contains the column name that’s why you want to skip that right if this is true then in the read range there is a property name Add Headers kindly check that option so it will treat Q1 as an header and skip that in the loop. i don’t know you are working with classic or modern but in both case you found somthing like this.enable that.
cheers
1 Like
Yoichi
(Yoichi)
May 2, 2025, 3:03pm
5
一行目はヘッダーでしょうか?このようなケースは繰り返し(Excelの各行)アクティビティを使うと良いように思えます。
The UiPath Documentation Portal - the home of all our valuable information. Find here everything you need to guide you in your automation journey in the UiPath ecosystem, from complex installation guides to quick tutorials, to practical business...
1 Like
gorby
(Noteworthy UiPath Forum contributer 2024)
May 3, 2025, 7:08am
7
こんにちは、Excel1行目はヘッダでしょうか?回答がYESの場合、
Excel(設定.xlsx)1行目に、key,value,descriptionという列名を入れて2行目以降にKey名、keyの値、説明文を入れます。
そうすれば、最初に範囲を読み込みアクティビティで、Excel(設定.xlsx)の内容をデータテーブルdt_SettingsData2に取得したあと、Selectメソッドで
str_inputファイルパス=dt_SettingsData2.Select("key='Inputファイルパス'")(0)("value").ToString
を実行すれば、String変数str_inputファイルパスにExcel(設定.xlsx)のB列の値を取得できます。繰り返しを使うより簡単と思います。
複数の変数に初期値をまとめて設定したい場合、私はこのアルゴリズムを使っています。
ご参考まで。
ワークフロー
設定.xlsx
1 Like
afna
(afna)
May 13, 2025, 1:35am
8
皆さんご回答ありがとうございます。
大変勉強になります!
Yoichi
後続フローで組み込みやすそうなので、ご回答いただけますと嬉しいです。。
一行目はヘッダの認識で相違ございません。
Q2,Q3,と保存した値をWEBアプリケーションに貼付て検索をかけたい場合はどのようなフローになりますでしょうか?
例:Q2の値をアプリに貼付>検索、Q3の値をアプリに貼付>検索
Yoichi
(Yoichi)
May 13, 2025, 2:47am
9
表がヘッダーを除いて2行しかないのであれば、例えば以下の様になると思います。
1 Like
afna
(afna)
May 13, 2025, 7:46am
10
ご回答いただきましてありがとうございます。
行数は都度変わる予定です。1行の場合もあれば5行ほどの場合もあります。
また、検索をかける際に検索ボタンがないのですがその場合は、ホットキートリガーアクティビティを使用して、Enterキーをしてする形で合っていますでしょうか。
よろしくお願いいたします。
Yoichi
(Yoichi)
May 13, 2025, 7:52am
11
意図としては、存在する行をすべて処理するのであればということでした。
(例えば5行のうち2行を処理するのではなく)
そうであれば上記の繰り返しで可能と思われます。
また、検索をかける際に検索ボタンがないのですがその場合は、ホットキートリガーアクティビティを使用して、Enterキーをしてする形で合っていますでしょうか。
ホットキートリガーは用途が異なりますので違います。
Submit手段がエンターキー押下しかないのであれば、入力モードをChromiumAPIにした上で、入力文字列の最後に改行コードを送り込む方法が良いかもしれません。(うまく動作するかは試してみないとわかりませんが)
1 Like
afna
(afna)
May 28, 2025, 6:03am
12
お返事ありがとうございます。
回答遅くなりまして申し訳ございません。
改行コードを送り込んでみましたがうまくいきませんでした。。。
Yoichi
(Yoichi)
May 28, 2025, 6:15am
13
既に実施済みでしたらスルーいただければと思いますが、Enterを送り込むには以下の様にしてみてはと思います。(入力モードがChromiumuAPIやHardwareEvent等で有効)
String型変数+"[k(Enter)]"
1 Like
afna
(afna)
May 28, 2025, 8:35am
14
ご回答ありがとうございます。
設定してみましたが、うまくいきませんでした。。
Yoichi
(Yoichi)
May 28, 2025, 11:20pm
15
入力モードは何にしていますでしょうか?HardwareEventを一度試してみてはと思います。
ちなみに文字は入力されていてEnterキーが認識されない状況でしょうか?
また手動操作の場合は検索キーワードの入力+Enterで検索開始の認識でよいでしょうか?
1 Like
afna
(afna)
June 10, 2025, 6:12am
16
HardwareEvenで解消しました!!!!
ありがとうございます!
system
(system)
Closed
June 13, 2025, 6:12am
17
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.