1 Reply Latest reply on May 31, 2009 8:30 PM by Michael Borbor

    Read Csv file

    parrygill

      Hi,

       

        Wondering if someone can help here. I want to open xsl or csv file and using below code

       

      var file:File = evt.currentTarget as File;
               file = file.resolvePath(file.nativePath);
               var fileStream:FileStream = new FileStream();
               fileStream.open(file, FileMode.READ);     
               var fileData:String =  fileStream.readUTFBytes(fileStream.bytesAvailable);       
               var endings:Array = [File.lineEnding, "\n", "\r"];

       

      but for some reason it return "ÐÏ ࡱá" funny value. Any idea why don't i get the correct data from file.

       

      belwo is the csv file i am trying to open.

      Title

      Given_Name

      Surname

      Gong

      Salutation

      Position

      Organisation

      Address_Line_1

      Address_Line_2

      Address_Line_3

      Suburb

      State

      Postcode

      Country

      Home_Phone

      Fax

      Other_Phone

      User_Field_1

      User_Field_2

      User_Field_3

      User_Field_4

      Mobile_Phone

      Second_Address

      Second_Address_Line_1

      Second_Address_Line_2

      Second_Address_Line_3

      Second_Suburb

      Second_State

      Second_Country

      Second_Postcode

      Langcode

      Website

      Mr.

      Jeff

      Alexander

      Retention Marketing

      Monday, April 13th, 2009

      Mr.

      Anthony

      Demaso

      Retention Marketing

      Monday, April 13th, 2009

      Sally

      Swinamer

      Yield

      Monday, April 13th, 2009

      Chris

      Torbay

      Yield

      Monday, April 13th, 2009

      Annette

      Warring

      Genesis Vizeum

      Monday, April 13th, 2009

      Mr.

      Mark

      Khoury

      Genesis Vizeum

      Monday, April 13th, 2009

      Mr.

      Andy

      Thorndyke

      Thorsons

      Monday, April 13th, 2009

      Shannon

      Rutherford

      Central Reproductions

      Monday, April 13th, 2009

      Mr.

      Rob

      Greenwood

      Central Reproductions

      Monday, April 13th, 2009

      Lisa

      Marchese

      Des Rosiers

      Monday, April 13th, 2009

      Mr.

      Michael

      Whitcombe

      McMillan LLP

      Monday, April 13th, 2009

       

       

       

       

      Thanks,

      Gill