turrier.fr

Source : ct|02.06.08

< Tutorials Computer, Multimedia, Chinese

Create a csv file compatible Excel

Introduction

The CSV format (Comma Separated Values) is simply a text file format, in which the significant characters strings are separated by semicolons (or sometimes by commas).

Every line of the text file represents the line of a table, and is ended by a cariadge return. The columns are separated each other with semicolons.

Once saved with a .csv extension, the text file can be opened with any software which can read this format. So, the Excel software opens a csv text file and displays automatically the good lines and columns.

Example

We will use the following text file "essai.csv"

NOM;PRENOM;AGE
Dupond;Robert;53
Leroux;Jean;41
Dubois;Bernard;32

image1

The following picture brings to light the various data columns in the file.

image2

Open the file with a hexadecimal editor. We see all the bytes contained in this file and in particular the carriadge return bytes (2 bytes OD and OA framed in red) and the semicolon bytes (1 byte 3B framed in blue).

image3

Open this file with Excel, and you will display the datas with a good presentation.

image4

Modify the datas in Excel and save the new file with the name "essai1.csv" for instance.

image5

Open the file "essai1.csv" with the Memo pad. You will find your data again in text format.

image6


Valid XHTML 1.0 Transitional

© http://turrier.fr (2007)