- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 04:13 PM
I'm exporting data from SQL Server Management Studio to csv files and then importing them to ServiceNow by way of "load data", create a new import set row and data source. Everything is working great except for certain files that contain additional commas. I'm getting an error when creating a new data source indicating that it expected x number columns but found y number of columns. I need to figure out how to resolve this. Here are more details.
1. I know it's being caused by the additional commas that are found inside some of the fields. These fields that contain these, however, are enclosed inside double quotes which is valid csv. I'm baffled why SN does not allow this.
2. I can temporarily open in Excel, search for commas and replace with spaces. The error goes away so I know the root cause is the extra commas. I cannot use this Excel find/replace as a permanent solution as I have many tables in which to do this for.
Here is a simple example showing what my valid csv file looks like.
header1, header2, header3, header4
data1, "data2 plus, comma in double quotes", data3, data4 <-- ServiceNow doesn't like this.
data5, data6, data7, "data8 plus, comma in double quotes" <-- ServiceNow doesn't like this.
p.s., the above is a valid format according to the Standard RFC 4180
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 05:21 PM
Service Now doesn't like multi-characters separators.
It is actually the space after the "," that are messing things up.
header1, header2, header3, header4
data1,"data2 plus, comma in double quotes",data3,data4 <-- ServiceNow is OK with this.
data1, "data2 plus, comma in double quotes", data3, data4 <-- ServiceNow doesn't like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 05:32 PM
Hi Joel,
That was my mistake. My file does NOT have the spaces after the commas as I showed above. It's actually like this. Other ideas? Thanks and sorry for leading you down the wrong path.
header1,header2,header3,header4
data1,"data2 plus, comma in double quotes",data3,data4 <-- ServiceNow still doesn't like this.
data1,"data2 plus, comma in double quotes",data3,data4 <-- ServiceNow doesn't like this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 05:42 PM
The example you are providing is actually working fine in my test instance.
Can you provide more information (instance version, data source setting, ...) and maybe some example CSV that is rejected on your instance?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 05:44 PM
You bet Joel. I'll scrub the data a bit and then make sure I'm posting a version that is causing the problem. I'll then post it. Thanks for spending you time on this Thursday night.