Help with CSV Import

I am getting ready to import my cattle herd into farmOS. I visited https://farmos.org/guide/import/ and watched the video. My question is on column header names. Is this fixed/limited to what is listed on the Animal import page and in the template file (Name, Archived, Description, Parent IDs, Parent names, Nicknames, Date of birth, Species/breed, Sex, Castrated, Tag ID, Tag type, Tag location)?
In the video, it was stated that unused columns could be deleted, so I wasn’t sure how fixed of a format the import process used or if it simply created whatever is specified in the CSV file. Wondering if I can add more Tag ID’s, Tag type’s and Tag locations to each animal? e.g. ideally, I would be able to specify ear tag, bangs tag and EID tag for each animal in the CSV file for import. Thank you for any help/clarification provided.

1 Like

Hi @ctomayer - good questions.

My question is on column header names. Is this fixed/limited to what is listed on the Animal import page and in the template file (Name, Archived, Description, Parent IDs, Parent names, Nicknames, Date of birth, Species/breed, Sex, Castrated, Tag ID, Tag type, Tag location)?

Yes, ONLY the columns in the template will be accepted.

Wondering if I can add more Tag ID’s, Tag type’s and Tag locations to each animal? e.g. ideally, I would be able to specify ear tag, bangs tag and EID tag for each animal in the CSV file for import. Thank you for any help/clarification provided.

Unfortunately, this won’t work. The CSV importer only includes columns for a single ID right now. I know there are a lot of folks who have more than one ID, though, so this would be a good feature request to open up.

Is it feasible for you to import one ID tag and then fill in the other one manually on each animal? Or - perhaps use the “Name” for one ID and the ID Tag for another? Just ideas… not sure if that would make sense for you.

The CSV importers in general are pretty limited in what they can do. The other more capable option is to use the farmOS.py Python library to write a script that reads your CSV and pushes records to farmOS over the API. But this is certainly more involved, requires knowing Python, etc.

I’m definitely interested in exploring more options for CSV import in general. FWIW, we are currently using the Feeds module: https://drupal.org/project/feeds - which is pretty flexible in some ways, but inflexible in others.

In the future it would it be possible to add an import column for Location. Idea being once imported the animals would end up being automatically placed in their correct paddock (assuming it exists already in farmos).

1 Like

Yes! And in fact @megandalster recently did some work on this: https://github.com/farmOS/farmOS/issues/199#issuecomment-659446449

So I think the next step is to review that and see if it can be reused to provide the additional columns in farmOS core CSV importers.

1 Like

Hello everyone,

I am preparing to import harvest data from a CSV file to FarmOS. I’m filling the “log_farm_harvest_template.csv” file from FarmOS.
I’m wondering if the sequence of the columns of this file are important ? can i re-order the column sequence in a more beneficial way for me ?

Thanks a lot for your answer !

1 Like

Hi @nathanrosenfeld - welcome to the forum!

The order of CSV columns does not matter - you can rearrange them however you’d like. You can also omit ones that you don’t need (unless they are required fields). As long as you leave the header names the same, it should work.

2 Likes

thanks !

1 Like