Wednesday, June 22, 2011

How to import data from CSV text file

Sample data:

0. Sample data file

The rule for CSV text file is the same as the one for Google Spreadsheet import.
Please check the following samples.

1. Data entry rules
2. Importing entire semester, course and events
3. Adding courses to existing semester
4. Adding events to existing semester
5. Updating existing events
6. Updating existing courses


Instruction:

A CSV file is a specially formatted plain text file, which stores spreadsheet or basic database-style information in a very simple format, with one record on each line, and each field within that record separated by a comma.

Most PC based spreadsheet program can create CSV file and we will use Microsoft Excel for this example.

Step 1) Excel

Go to Excel and open a spreadsheet.


Step 2) Header

Create header line in the first row with the titles of each column. Available column titles are as follows.


termTitle (required column)
termStartdate (should be YYYY_MM_DD format)
termEnddate (should be YYYY_MM_DD format)
termNote

courseTermTitle (required column)
courseTitle (required column)
courseLocation
courseInstructor
courseEmail
courseWeb
coursePhone
courseOffice
courseCredit
courseNote

eventTermTitle (required column)
eventCourseTitle (required column)
eventType (required column)
eventDate (required column, should be YYYY_MM_DD format)
eventStarttime (required column, should be HH_MM format)
eventEndtime (should be HH_MM format)
eventLocation
eventNote

These columns will be processed in three groups by the import program.
The ones with "term" prefix will be used for term or semester, and the column with "course" and "event" prefix will be treated as course and event data.

Please make sure to use only the titles listed above. If the column is not properly titled, all the values in the column will be ignored.


Step 3) Rows

Enter your term, course and event information from the second row.



When entering the data, please make sure your data meet following format requirements.


1. Date format
All the date values should be in "YYYY_MM_DD" format.
(i.e. 2011_12_31, 2012_02_08, ...)

2. Time format
All the time values should be in 24 hour "HH_MM" format.
(i.e. 23_59, 09_00, 15_00, ...)

3. Match term titles
The value in "courseTermTitle" and "eventTermTitle" column should match to the term title in "termTitle" column. Otherwise, Class Buddy cannot associate the course and event to the right term

4. Match course titles
The value in "eventCourseTitle" column should match to the course title in "courseTitle" column. Like the term title, this is also critical to link the events to the right course

5. Match event type
From v1.36, users are allowed to rename the event types in "Event type description" Setting. The value in "eventType" column should match to the type name defined in the Setting.

For the previous versions, please use one of the following pre-defined value.
"class, assignment, project, quiz, exam, meeting, lab, report, reading, exercise"

6. Include the required fields
Make sure you include the required columns. If the required info is not provided, Class Buddy cannot know how to associate the provided info to existing term and course hierarchy



Step 4) Save

Save the spreadsheet.


When saving file, make sure to save the spreadsheet as "csv" type. For this, use the "CSV (Comma delimited) (*.csv)" option in "Save as Type". Class Buddy cannot understand the default "xls" type.


Step 5) SD card

Now, you are done with Excel. Copy the file to SD card and go to Class Buddy


Step 6) Import screen

In import screen, you will see the list of folders and files in SD card. Folders have yellow folder icon in left, and CSV files has white import icon in right side.


Press the csv file you just created in Excel. Then you will see the list of rows you have created.


Step 7) Import

Please make sure you don't see any errors in your spreadsheet. If there's error, please fix and restart the import. Until all the errors are fixed, "Import" button will not be enabled.


Extra) Language encoding problem

If your csv file includes non-English characters such as Asian two-byte character, you will have display problem.

This problem is mostly caused by the language-encoding difference between Windows Excel and Android OS. If you are familiar with encoding, you may solve the problem using third party notepad application such as NotePad++ or EditPlus. These programs can convert "ASCII" in Excel CSV to "UTF-8" which is used by android OS. Otherwise, we recommend "Import from Google Docs" option instead of CSV import.