Datatable型の行抽出について

表形式のデータテーブルを「Dt1」というDatatable変数に格納後、
そのデータテーブルから1番上の行(ヘッダー除く)のみを抽出し、
別のExcelファイルに抽出した行データを張り付ける方法について
ご教示ください。

1 Like

@mac1

  1. First create one DataTable with all required columns using Build DataTable activity and say ‘newDT’.

  2. To read the first row from DataTable.
    DataRow firstRow = Dt1(0)

  3. And then use Add DataRow activity and pass that firstRow and DataTable as newDT.

  4. And then use Write Range activity and pass newDT to write into required excel file.

1 Like

@mac1 さん

こんにちは。
1 「代入」を使用して、dtCopyData = Dt1.clone
2 「メソッドを呼び出し」、Targetobject = dtCopyData,MethodName =ImportRow,プロパティのパラメータを追加して、Dt1.Rows(0)を指定してください。
3 「範囲に書き込む」で2で作成したのデータテーブルを書き込みます。
以上です、ご参考まで

こんにちは

もっと簡潔に書けそうなので...

  1. DataTable型変数NewDtを用意し、Assign(代入)アクティビティで
    NewDt={Dt1.Rows(0)}.CopyToDatatable()

  2. WriteRange(範囲書き込み)でNewDtを書き込み

4 Likes

早くの回答ありがとうございます!
やりたいことができましたので報告となります。

ありがとうございました!!

1 Like

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