User Manual

08.14.2024

MANUAL

FAQ: I want to create or update a target record by reading a CSV file in a batch process

## Answer Use the "[Import API Record](/en/manual/api-import)". --- ## Overview If you want to load a CSV file in batch processing and create or update the target records, use the "[Import API Record](/en/manual/api-import)". As an example, insert the items loaded from the CSV file in the table below into the items in Pleasanter. If the value of id (ClassA) already exists in Pleasanter, it will be overwritten and updated. In order to check the ID, the "[Search Type](/en/manual/table-management-search-type)" of ClassA must be set to an exact match. Save the CSV data to be imported in the same folder as the script file. |CSV item|Pleasanter item| |:--:|:--:| |name|Title| |id|ClassA| |mail|ClassE| ## Operation Procedure 1. Open Pleasanter and create a table 1. Open "「Table Management」" and enable Classification A and Classification E in the "[Editor](/en/manual/table-management-editor)" tab. 1. Open the "[Filter](/en/manual/table-record-search)" tab, select Classification A, click the Advanced button, change "[Search Type](/en/manual/table-management-search-type)" to an exact match, and then click the Change button. 1. Click the Update button. 1. Use the Back button to return to the list screen. 1. Create an API key in "API Settings" from the user menu and copy the key. 1. Note the site ID of the target table. 1. Copy the example CSV file below and save the file as data.csv. 1. Copy the sample code below and save the file as import.ps1. 1. Modify line 8 of import.ps1 to match the character code of the CSV file. 1. Change the site ID and API key on lines 1 and 2 of import.ps1 and save it. 1. Execute import.ps1. ### Create a CSV file (data.csv) ```` id,name,mail 1,user1,user1@example.com 2,user2,user2@example.com 3,user3,user3@example.com 4,user4,user4@example.com 5,user5,user5@example.com 6,user6,user6@example.com 7,user7,user7@example.com 8,user8,user8@example.com 9,user9,user9@example.com 10,user10,user10@example.com ```` ## Sample Code ##### PowerShell ```` $url = 'http://localhost/api/items/xxxsiteidxxx/import' $apiKey = 'xxxAPIKeyxxx' $filePath = "./data.csv" $form = @{ parameters = ConvertTo-Json @{ ApiVersion = 1.1; ApiKey = $apiKey; Encoding = "UTF-8"; UpdatableImport = $true; Key = "ClassA"; }; file = Get-Item -Path $filePath; } Invoke-WebRequest -Uri $uri -Method Post -Form $form ```` ## Related Information <div id="ManualList"><ul><li><a href="/en/manual/table-record-search">Table Function: Search for Record (Filter)</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-editor">Table Management: Editor</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/table-management-search-type">Table Management: Search: Search Settings: Search Type</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/api-import">Developer Function: API: Table Operation: Import Record</a><span>08.14.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.