---
title: "Purpose of \"Import Data from CSV\" button"
url: "https://openforis.support/questions/85/purpose-of-import-data-from-csv-button"
tags: ["collectearth"]
status: "accepted"
score: 0
answer_count: 5
asked: "2014-11-06T18:21:37"
last_activity: "2020-01-14T09:35:45"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Purpose of "Import Data from CSV" button

Asked by Antonia on 2014-11-06

What is the purpose of the "Import Data from CSV" button under Data Import/Export? I know that it is NOT for 

 - importing a new point grid (that's under Properties)
 - importing a data base (that works via XML files)


## Accepted answer (score 1, by collectearth on 2014-11-06)

Link: https://openforis.support/questions/85/purpose-of-import-data-from-csv-button/87

I agree the naming is confusing as the functionalities are different.

So basically in the coming version of Collect Earth the menu items will change name to something like :|

 - Add new records from **XML**
   
 - Update existing records with **CSV**

See the link that Giulio posted for more information of how to update the data already recorded in the database.


## Answer (score 2, by gmarchi on 2014-11-06)

Link: https://openforis.support/questions/85/purpose-of-import-data-from-csv-button/86

Hi Antonia, just today we were discussing about the naming of that feature since it will only update the values that are already present but it won't import new records. If you want to import records into a blank database, you need to import the XML exports.

This other discussion may shed more light.

[http://www.openforis.org/support/questions/80/changing-plot-attributes-in-the-collect-earth-database][1]

Thanks,

Giulio


  [1]: http://www.openforis.org/support/questions/80/changing-plot-attributes-in-the-collect-earth-database


## Answer (score 0, by J_Johanness on 2019-12-27)

Link: https://openforis.support/questions/85/purpose-of-import-data-from-csv-button/2571

Hi there @gmarchi

If I understand what you are saying correctly, this means that the only way I can import new records into a blank database is to import the XML exports. Will I be able to do this using the CSV exports? I have been always exporting my survey data via the CSV export function, and not the XML export function.

Warmest regards, 
Johanness


## Answer (score 0, by Open Foris on 2020-01-02)

Link: https://openforis.support/questions/85/purpose-of-import-data-from-csv-button/2573

In response to @J_Johannes:

The purpose of the *Tools->Data Import/Export->Update Current Records Using CSV* is to update data currently on the database. This is not helpful for your purpose

**AS A RULE: ALWAYS EXPORT THE DATA USING THE XML OPTION!** This way you will always be able to easily import it into the database!

![alt text][1]

Since you only have the data as CSV then you are going to need to import the data using [Open Foris Collect][2] (attention, not Collect Earth, but Collect, the application that is used also to design the surveys)

So, this is a bit more complicated, roughly speaking these are the steps :

 1. Install [Collect][3] if you still don't have it!
 2. Open Collect ( Windows button --> Open Foris Collect )
 3. Import the survey you are using into Collect ( see [this video][4], bit old so with an older interface, but the concepts are the same ) 
 4. **PUBLISH THE SURVEY** (this way the survey will be accessible in the Data Management section of Collect where the CSV can be imported)
 5. Now go to the **Data Management** section. Choose the survey you just published on the top-right selection field.
 6. Click on the *Import -> From CSV/Excel* button on the top menu.
 7. In the screen that appears select the *Import Type* option "*Insert new records*" and then select the CSV with your data! ...... OK, not really that easy (that is why we prefer the XML export/import to the CSV option) ... WHY? Because in Collect a survey has a root entity (i.e. the plot entity) which in its turn might  have sub-entities ( i.e. the Land Cover/topography entity) which act as linked tables to the main table (the plot) if you are thinking from a relational database point of view. This means that in this process one must first import the data for the plot table, and then import the data for the entities inside the plot...
 8. Now you have to divide the data in your CSV into the different entities it belongs to. If you used the Collect Earth IPCC template for your survey then you will have the plot entity (main) and the topography entity (linked to the plot). So the trick is to divide the columns of the CSV you have into the CSV for the plot and the CSV for the topography. In order to see what is the expected columns in each one of the files you could go to the Data Management, use your survey and then export the data (maybe if you have a few plots on the DB) and Export as CSV with one CSV per entity. If you have calculated attributes inside the entities you do not need to import them!
 9. When you import the CSVs then you have to also explicitly choose which entity you are importing teh data for. First you should import the root entity data (plot) as the sub-entities (topography) reference the plot that their data belongs to:
This is an example of a few plots from the plot CSV ( see that the id and round columns are the key attributes of this specific survey) 
![alt text][5]
And this is the resulting topography csv, notice how for ech type of land cover there is a reference to each plot ( combination of id and round attribute)
![alt text][6]
 10. OK... this is quite complex and error prone. Please let us know if you get stuck!

I will post more images later to guide you better!


  [1]: http://www.openforis.org/support/upfiles/2020-01-02_11-18-11_1.png
  [2]: http://www.openforis.org/tools/collect
  [3]: http://www.openforis.org/tools/collect
  [4]: https://www.youtube.com/watch?v=Ml76no4XAdk
  [5]: http://www.openforis.org/support/upfiles/soffice.bin_2020-01-02_12-47-44.png
  [6]: http://www.openforis.org/support/upfiles/soffice.bin_2020-01-02_12-48-03.png


## Answer (score 0, by J_Johanness on 2020-01-14)

Link: https://openforis.support/questions/85/purpose-of-import-data-from-csv-button/2586

That was a wonderful and very detailed explanation, on a feature in Open Foris Collect that I was personally unfamiliar with. Thank you, I will try it next time if the opportunity arises. Thank you for the step-by-step guide, and the link to the tutorial video as well! It is very much appreciated.

From now on, I will abide by that rule: **ALWAYS EXPORT THE DATA USING THE XML OPTION!**

Thank you very much, this has been very informative.

Warmest regards, 
Johanness
