Scheduled CSV Data Load with Headers below row 1?

zachkenyon
ServiceNow Employee
ServiceNow Employee

When doing an import from a CSV via the Load Data module under Import Sets, you can specify which row the header data is on.

However, I can't figure out how to do that for a repeating/scheduled data load. I've set up the Data Source to get the CSV file via SFTP, and set the Scheduled Import up, but I don't see anywhere to speficy what the header row of the CSV is.

Is there some way to specify that via a pre-import script on the Scheduled Import?

8 REPLIES 8

Jon Fung, has this worked for you? Because it doesn't work for me...setting the header row to be other than row 1 when importing a CSV and I suspect it is because "CSV files must comply with the proposed CSV standard in RFC4180...The first row of data in an imported CSV file becomes the header row and defines the columns for that import set" per the wiki.



If you got this to work I'd really appreciate you sharing the information.


Thanks,


- Sherry


Since I have to collect these CSV files with a cron job, I simply added:



sed -i '1d' filename.csv


// OR


sed -i '/UTF-8/d' filename.csv //safer unless utf-8 is a value in your data. #YMMV


KamalM
ServiceNow Employee
ServiceNow Employee

I've managed to get this working in the following way:


1) Load the CSV manually using "Load Data", this will create the data source and can also create the import set table if you don't already have it. make sure you select your header row number.


2) Check the loaded data to make sure that it used the correct header row. Also setup your transform map if needed.


3) Go to the data source and change it to FTP/SFTP and enter the rest of the server/path details.


4) Go to "Scheduled Imports" and create a new scheduled import for the same data source.



Hope that helps!


Community Alums
Not applicable

Hi Kamal,

This didn't work for me. Datasource is working when I use as attachment but not when user FTP source.

Let me know if you did any additional settings.