0 Replies Latest reply on Mar 10, 2010 4:30 AM by Rémi53Fx

    How to import Excel data in a datagrid


      Hey from FRANCE!


      I would like to feed a datagrid with a .xls document.

      I've seen that it is possible thanks to as3xls library.

      But I need your help to explain me the first step of the tutorial http://code.google.com/p/as3xls/wiki/Tutorial which is "1.You need to get the Excel file into a ByteArray of some sort, whether by hook, crook, or Embed."


      I tried the following code without success :


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
      import com.as3xls.xls.Sheet;
      import com.as3xls.xls.ExcelFile;

      var fichierexcel:FileReference = new FileReference();
      fichierexcel.load( new URLRequest("bdd.xls"))
      var myByteArray:ByteArray = fichierexcel.data;          
      var xls:ExcelFile = new ExcelFile();

      var sheet:Sheet = xls.sheets[0]
      var value:String = sheet.getCell(0, 0).value;
      myDataGrid.dataProvider = sheet.values;

      <mx:DataGrid id="myDataGrid">



      Can you correct it, please?