Select to view content in your preferred language

"Not as many fields as field headers" Import CSV file

2615
19
Jump to solution
06-07-2022 09:54 AM
SharitaU
New Contributor II

Hi all,

I'm trying to import a very simple CSV file of workers in Workforce. When I try to import my CSV which has the same headers as the template CSV file, or even when I try to add new rows to the template CSV file, I get an error that says "Not as many fields as field headers".  Has anyone had this problem before/can anyone give me feedback.

Here's a screenshot of the csv I have tried to upload

workforce erro.PNG

 

 

Thank you all!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
CraigGillgrass
Esri Regular Contributor

Closing the loop from the DM with @OznurGeze ; opening the csv in Excel can insert an empty row at the bottom of the file. By using Notepad (for Windows) this is avoided and the csv can be uploaded.

View solution in original post

19 Replies
julian_svcs
Occasional Contributor

I would say it is because of the comma in the Truck Driver, Night Shift cell. A CSV by default uses commas to separate the columns. The comma in this cell is causing is to split into another column, thereby creating another column for that row.

You would need to add double quotation marks to escape the comma so it would look like this:

"Truck Driver, Night Shift"

0 Kudos
SharitaU
New Contributor II

Greetings,

The first two rows actually came with the sample template. I did however try to delete the comma and still got the same error unfortunately. Although I am able to reupload their exact template with no errors but that ruins the point of using a csv to upload workers if I can't actually add workers. 

0 Kudos
julian_svcs
Occasional Contributor

Would you be able to share your CSV file? I can have a quick look.

0 Kudos
SharitaU
New Contributor II
 
0 Kudos
julian_svcs
Occasional Contributor

Thanks for the file.

The error does not match what is the issue. The issue is the empty last line in the CSV file. Remove that empty row and you will be able to import the CSV file to add the users.

0 Kudos
ISDEsriNeA
New Contributor II

@julian_svcs  i tried this solution, but it still not working, any other recommendation?

0 Kudos
julian_svcs
Occasional Contributor

@ISDEsriNeA Can you make you CSV file available so I can see what the issue could be. Thanks

0 Kudos
CraigGillgrass
Esri Regular Contributor

@ISDEsriNeA @SharitaU the issue is as @julian_svcs mentions, there is a trailing empty row in the csv file - this is bug in the template that we've addressed but older versions of the template file still exist.

Removing the trailing empty line will address the issue and allow the import verification to proceed. I've attached an edited version of the csv that @SharitaU first posted.

@ISDEsriNeA when you mention it is still not working, can you clarify?  Does it fail with an error and if so, what is that?  As @julian_svcs mentions, if you can, uploading the csv will help to quickly diagnose the issue.

0 Kudos
OznurGeze
New Contributor III

Hi,

@CraigGillgrass  I tried the data updated version you shared. Still same error. 

OznurGeze_0-1660219474699.png

 

 

0 Kudos