CSV Format to Upload Communities¶
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 our Squirro platform, the CSV format is based on specifications mentioned in RFC-4180. In order to upload communities, the following points have to be kept in mind:
Separate data fields with a comma (
,) as delimiter.
Keep each record on a separate line. Each record must start on its own line.
In the first line of the file, include a header with a list of the column names in the file. For a community, the following headers can be passed:
The headers are not case-sensitive. Any additional headers that are provided shall be ignored.
If no header is included, then the CSV should only contain one column per record which would be the
nameof the community.
Make sure the header list is delimited in the same way as the rest of the file.
Remember that the enclosing character (typically double quotes) must be used when required, such as when the delimiter appears in a field.
Try not to use any spaces before and after the delimiter (comma).
Examples of Valid CSV Formats¶
This will create three communities with name India, Nepal and Switzerland, and facet_values “india“, “nepal“ and “switzerland“.
name,facet_value India,india Nepal,nepal Switzerland,switzerland
This will create three communities with name India, Nepal and Switzerland.
India Nepal Switzerland
This will create three communities with name India, Nepal and Switzerland, and facet_values “india“, “nepal“ and “switzerland“. The language field will be ignored.
name,facet_value,language India,india,Hindi Nepal,nepal,Nepali Switzerland,switzerland,Deutsch
Examples of Invalid CSV Formats¶
The following would be incorrect as it does not include the header containing the name of the columns.
India,india Nepal,nepal Switzerland,switzerland
The following would be incorrect as the records are not separated by newlines.