> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therefrain.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 一括データ入力

> CSV から読み込んだデータを Web フォームに一括登録。UI が変わっても止まらない。

## 概要

Web フォームへのデータ入力は、あらゆる組織で最も繰り返しの多い作業のひとつです。新入社員の登録、取引先情報の入力、レガシーシステムへのレコード更新など、API がなければ手作業で一件ずつ入力するしかありません。

Refrain のバッチ実行機能は CSV の各行を読み込み、1 行ずつフォームに入力・送信します。自己修復するセレクタにより、フォームの UI が変わっても自動化が止まることはありません。

## 手順書の例

```yaml theme={null}
name: bulk-employee-registration
url: https://hr.example.com/employees/new
variables:
  - name: first_name
    source: data
  - name: last_name
    source: data
  - name: email
    source: data
  - name: department
    source: data
steps:
  - action: input
    selector: "#firstName"
    value: "{{ first_name }}"
  - action: input
    selector: "#lastName"
    value: "{{ last_name }}"
  - action: input
    selector: "#email"
    value: "{{ email }}"
  - action: select
    selector: "#department"
    value: "{{ department }}"
  - action: click
    selector: "#submit"
    requiresConfirmation: true
    confirmationMessage: "{{ first_name }} {{ last_name }} の登録を送信しますか？"
  - action: wait
    selector: ".success-message"
```

## 生成と実行

<Steps>
  <Step title="手順書を生成する">
    ```bash theme={null}
    npx @refrainai/cli generate -- \
      --url https://hr.example.com/employees/new \
      --goal "従業員登録フォームに入力して送信する" \
      --context ./context.md \
      --output ./employee-registration.yaml
    ```
  </Step>

  <Step title="CSV を準備する">
    ```csv theme={null}
    first_name,last_name,email,department
    太郎,山田,taro@example.com,エンジニアリング
    花子,鈴木,hanako@example.com,マーケティング
    次郎,佐藤,jiro@example.com,営業
    ```
  </Step>

  <Step title="バッチ実行する">
    ```bash theme={null}
    npx @refrainai/cli execute -- \
      --runbook ./employee-registration.yaml \
      --data ./employees.csv
    ```
  </Step>
</Steps>

## Refrain が向いている理由

* **CSV 駆動** — 各行が 1 回のフォーム送信に。コード不要。
* **自己修復** — フォームのフィールド変更にも自動対応。
* **行ごとの承認** — `requiresConfirmation` で送信前に個別レビュー。
* **スケーラブル** — 数百・数千行のバッチ処理にも対応。

## 次のステップ

<CardGroup cols={2}>
  <Card title="手順書を実行する" icon="play" href="/ja/guides/execute-runbook">
    CSV データを使ったバッチ実行を学ぶ。
  </Card>

  <Card title="変数とシークレット" icon="key" href="/ja/guides/variables-and-secrets">
    データソースと変数解決を活用する。
  </Card>
</CardGroup>
