Import API - CSV - set the delimiter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi community,
I'm actually facing an issue while trying to import a CSV file via Import Rest API.
Indeed, the separator in my file is the semi column (";"), so when I import my file through Import REST API (
sys_import.do), it doesn't recognize my separator (I guess Service Now Expect a comma).
I know that we can specify the separator in a data source, so can we do the same in REST API, using a parameter or anything else ?
Thanks !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @mathieu_brule,
The sys_import.do REST API does not have a parameter to specify a custom delimiter like a semicolon. It expects a standard comma-separated file. The best practice to handle this is to use a pre-configured Data Source. First, create a Data Source record in ServiceNow and set the CSV delimiter field to a semicolon (;). If you can't see the delimeter field then add it through personalising.
Then, instead of calling sys_import.do, you should use the Attachment API to upload your CSV file directly to that Data Source record. Once the file is attached, you can programmatically execute the import for that specific data source, which will correctly parse your file using the defined semicolon delimiter. This approach uses the platform's full ETL capabilities and is the recommended way to handle non-standard file formats.
Hope this helps!
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution and helpful so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Thanks for your answer, but unfortunatly, files I have to import come from another System, and I have to use import set API...
Is there any sys property that explicits the expected separator or anything else ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
54m ago
Hi @mathieu_brule,
Unfortunately, there is no system property or API parameter that you can use to change the expected CSV delimiter for that specific endpoint. The sys_import.do processor is designed for simplicity and expects a standard, comma-separated format. The ability to configure delimiters is a feature of the Data Source record itself, which this direct API call bypasses.
Since you cannot pre-configure a Data Source, you could try:
Modify the Source: The most robust and recommended solution is to configure the source system to generate the file with commas (,) instead of semicolons (;). This resolves the issue at the root and ensures you are using the API as intended.
Use a Transform Script: If you absolutely cannot change the source file, you can use a workaround. When you import the semicolon-separated file, all the data will be loaded into a single column in your import set table. You can then use an onBefore Transform Script to parse this single column. In the script, you would take the string from that one field, use JavaScript's .split(';') function to break it into an array, and then manually map each element of the array to your target fields. This is less efficient and requires more maintenance but will work in a pinch.
Hope this helps!
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution and helpful so others can benefit as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
38m ago
yes ServiceNow expects comma as delimiter.
check this link and it has video on how to do this with custom delimiter
Importing CSV Data with Custom Delimiters
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader