CSV and Excel Formatting for Upload#

Profile: Project Creator

This page describes how to upload CSV and XLS files when creating communities.

Project creators can upload CSV or XLSX files to create communities. The CSV or XLSX file must be formatted correctly for the upload to work.

File Types#

CSV#

A comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas.

A CSV file typically stores tabular data (numbers and text) in plain text, in which case each line will have the same number of fields.

In the Squirro platform, the CSV format is based on the RFC-4180 specification.

XLSX#

A Microsoft Excel file can also be used. It is recommended you use the XLSX format, not the XLS format associated with Microsoft Office 1997-2003.

How to Structure Data#

To work correctly, CSV or XLSX data must be structured as follows:

  • Each record must start on its own line.

  • Separate data fields with a comma (,) as a delimiter.

  • Avoid spaces before and after the delimiter (comma).

  • An enclosing character (typically double quotes) must be used when required, such as when a delimiter appears in a field.

Headers#

Note

Labels are termed facets in the Squirro code. Any time the code references facets, it is referencing what the UI calls labels.

  • In the first line of the file, include a header with a list of the column names. Community headers may include:

    • Name

    • Image

    • Facet_value

  • If no header is included, then the CSV should only contain one column per record, being the name of the community.

  • Delimit the header list in the same way as the rest of the file.

Note: Headers are not case-sensitive, and any additional headers provided are ignored.

Examples of Valid Formatting#

The following are three examples of valid CSV or XLSX formats:

Example A

name,facet_value
India,india
Nepal,nepal
Switzerland,switzerland

This will create three communities with the names of India, Nepal, and Switzerland, and facet_values india, nepal, and switzerland.

Example B

India
Nepal
Switzerland

This will create three communities with the names India, Nepal and Switzerland.

Example C

name,facet_value,language
India,india,Hindi
Nepal,nepal,Nepali
Switzerland,switzerland,Deutsch

This will create three communities with the names India, Nepal and Switzerland, and facet_values of india, nepal and switzerland. The language field will be ignored.

Examples of Invalid CSV Formats#

  1. The following is an incorrect example as it does not include the header containing the name of the columns.

India,india
Nepal,nepal
Switzerland,switzerland
  1. The following is incorrect as the records are not separated by new lines.

India,Nepal,Switzerland