Adding data is a common activity and Sahana Eden offers a variety of ways to do both batch imports and manual data entry. This section covers importing data from CSV files and some basic troubleshooting.
Import from Spreadsheets
If you have existing data available in a spreadsheet format it can be imported into Sahana Eden to populate the database.
Resources which support spreadsheet import, have an "Import" menu item in the module menu:
1. Download a CSV Template
Go to the module (e.g. Inventory management), and find the Import menu item for the resource you want to import data to (e.g. Warehouses):
By clicking Import you get to the upload page which contains a form to upload a new CSV file, and a list of prior imports (this list may be empty):
If you click on the Download Template link in the upload form, you can download an empty CSV file for this data resource in the required format (this CSV file will just have column headers):
2. Fill in the CSV template
Fill in the CSV template with your data or re-format your existing spreadsheet data to match this template:
Note that you may change the order of the columns, but do not rename or change the column headers!
3. Upload the CSV fileAfter you filled in the CSV file with your data, go back to the upload page in Sahana Eden,
choose your CSV file and click Upload Data File.
4. Review the records and confirm the Import
After uploading the CSV file, Sahana Eden will show a list of records to import ("Import Items") from your CSV file, along with any validation errors:
Review the records displayed on the list. You can expand the record details by clicking on Display Details.
Records can be selected for import or de-selected by clicking into the Element column of the respective row. Selected rows turn green and de-selected rows turn gray, while rows with errors are shown in red (those cannot be selected for import).
Once you have selected which rows shall be imported, then click Submit to import the selected rows into the database
Sahana Eden reporting validation errors:
- Correct any red colored rows (invalid data) according to the error message displayed in the error column by making the corrections in the CSV file.
- From the review page choose the Import menu item and re-upload the CSV file with the corrected data.
Data not being imported as expected:
Note: This refers to data which passed Sahana Eden's validation but does not correspond to the user's expectation of correctness (e.g. latitude ending up in a name column). Here are some common things to check or try to address the errors:
- You may change the order of the columns, but not rename the column headers
- Data must use UTF-8 character encoding
- Export/Save as CSV file (.xls and .xlsx are also supported although require an up to date version of the python xlwt library. Using CSV is the safest method)
- CSV must use comma as value separator and double quotes (i.e. ") as quoting character.
- A common problem is that cells containing whitespace or commas aren't enclosed in quotes
- All data must be in a single worksheet
- Duplicates will be resolved automatically. Where this fails you might need to check spelling, remove any leading or trailing whitespace in your cells, and make sure the CSV is using UTF-8 character encoding