Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Import API - CSV - set the delimiter

mathieu_brule
Kilo Sage

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 !

1 ACCEPTED SOLUTION

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:

  1. 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.

  2. 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.

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

View solution in original post

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@mathieu_brule 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@mathieu_brule 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader