Csv 파일 행추가와 데이터 수정

UiPath 입문자입니다.

csv파일을 실행시켜서 데이터 테이블에 row 데이터를 추가하거나 특정 셀 데이터를 수정하고 싶습니다.
어떤 액티비티를 써야하고 로직을 짜야할지 모르겠어요

HI @Benimaru

→ You can use Read CSV activity to read the CSV File and store in a datatable.
→ Then you can use the datatable activities to perform the required actions.
→ After that use write CSV Activity to write the Output datatable to same CSV file.

If you give me what are the actions you want to in datatables, then we will give the suggestions how to do it.

Hope it helps!!

Hello @Benimaru,

  1. “Read CSV” 활동을 사용하여 CSV 파일에서 데이터를 읽어와 DataTable 변수에 저장합니다.
  2. “Add Data Row” 활동을 사용하여 원하는 데이터로 DataTable에 새로운 행을 추가합니다.
  3. “Assign” 활동을 사용하여 특정 셀 값을 수정하는 데에는 행 및 열 인덱스를 참조합니다.

@Benimaru,

To accomplish your task of adding row data to a DataTable or modifying specific cell data using UiPath, you can follow these general steps:

  1. Read CSV File: Use the “Read CSV” activity in UiPath to read the contents of your CSV file into a DataTable variable. This activity will automatically create a DataTable with the data from the CSV file.
  2. Modify DataTable: Once you have the DataTable loaded with the CSV data, you can use various activities to add new rows or modify existing data in the DataTable. Here are some common operations:
  • To add a new row, you can use the Add Data Row activity.
  • To modify specific cell data, you can directly access the DataTable using its row and column indices or column names and set the value of the cell.
  1. Write DataTable to CSV: After making the necessary modifications to the DataTable, you can write the updated DataTable back to a CSV file using the “Write CSV” activity.

Here’s a simple example:

1. Read CSV File:
   - Use the "Read CSV" activity to read the CSV file into a DataTable variable (e.g., `dtCSV`).

2. Modify DataTable:
   - Use activities like "Add Data Row" to add new rows to the DataTable or directly modify the values of specific cells in the DataTable.

3. Write DataTable to CSV:
   - Use the "Write CSV" activity to write the modified DataTable back to a CSV file.

Thanks,
Ashok :slight_smile:

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