"Open in Excel": Another AIR 2 Mini Sample

In Adobe AIR 1.0 and 1.5, there were different options to “open” the data of a Flex DataGrid in Excel. For example, you could leverage the AIR native drag-and-drop support to drag rows from the DataGrid to an open Excel spreadsheet. You could also drag rows to the desktop (or anywhere on the file system) as an .xls file. These two approaches are demonstrated in my Salesbuilder sample application. Another approach was to use a server roundtrip to download the generated .xls file from the server and force Excel to open with the data.

There was however no immediate way to implement a straight (client-side only) “Open in Excel” feature (aka click a button to open your DataGrid data in Excel). With AIR 2.0 and the new File.openWithDefaultApplication() method this becomes extremely easy to implement. In the sample below, I provide an example of this new feature. The sample also supports the drag-and-drop approach from the AIR application to Excel and from the AIR application to the desktop (or anywhere else on the file system). This sample uses the as3xls library to create the Excel spreadsheet. View Source is enabled.

Installation Instructions

  1. Download the AIR 2.0 beta runtime here.
  2. Download AIR2Excel.air here.
  3. Double-click AIR2Excel.air in Explorer or Finder to start the installation process.
  • Nathan

    WOW.. This is what I’m waiting for the long…

    Thanks Christophe… AIR Rocks.. ;)

  • Pingback: Tomcat Launcher: Sample Application using the AIR 2.0 Native Process API()

  • Pingback: andy.edmonds.be › links for 2009-12-04()

  • Wow. Thanks for article.

  • Pingback: AIR 2.0 Web Server using the New Server Socket API()

  • vivian

    Hi Christ,
    When I run your salesbuilder-v2, I got several errors related to ilog.utils
    such as:
    Definition ilog.utils:GregorianCalendar could not be found.
    Definition ilog.utils:TimeUnit could not be found

    Could you let me know where I can find the ilog.utils package?
    Thank you!

  • vivian

    oh,…actually, I worked it out. :)

  • Oleg

    That is a nice sample. Is there any way to Read Excel file ?

    Also, since Excel 2007 there is a new nice file format – XLSX, which is compressed XML file.
    Any integration with that ? In fact, how can one read/write compressed files in AIR.

    In addition, there is a Java API called Apache POI, which works with XLS and XLSX.
    Any integration with that ?


  • Pingback: AIR 2 / Flash Player 10.1 Beta Info « Devgirl’s Weblog()

  • Just what I was looking for – many thanks

  • Scott

    Trying to install the AIR2Excel.air file and getting the following error:

    This application requires an update to Adobe AIR that is not available for your system.
    Please view the system requirements for Adobe AIR and update your system accordingly.

    I am running the latest Air 2 beta 2. Any idea?


  • Jeff Boothe


    It was great meeting you in Tampa last month.

    Just wanted to see if you could update your example to work with AIR 2 beta 2.


    Jeff Boothe

  • Chinmay


    Is there any way i can read an Excel file in AIR?


  • thats what i want.
    thanks alott

  • Daniel

    Thanks for sharing.
    I have done some research about export data to excel file for a while.Right now, it seems that the project as3xls could not support export data to excel file with formula and format.I would apprecaite if you could give some suggestion about how to implement that functionality with formula and format.


  • thats what i want.
    thanks alott

  • srinath

    Thanks for sharing,
    How to read the header data.


  • srinath

    How to export grouped datagrid to Excel


  • Tom

    Where can I find the source code for this application?

  • Thanks. someone saved my life :D

  • thank you very nice excel very good

  • Always in Stock, Lowest Prices, Huge Selection, and Super Fast Shipping. Cherokee Workwear, Studio B, BabyPhat, Scrubs HQ, Team Scrubs,Dickies Scrubs, Skechers scrubs, Tooniforms, Zone Clogs,Skechers shoes and Avia.

  • maternity medical uniforms

  • cheap scrubs with free shipping

  • WOW.. This is what I’m waiting for the long…

  • Nice work

    Could u let me know how can i import 2007 excel file

  • Clay

    Is it possible to export an image to excel through as3xls?

  • Great summary of what it is really like – it’s not perfect, but with a little creativity and help from the employer – it is a great step to providing the best nutrition and protection to our children. I work as a lactation consultant in Northern California and many of the companies we work work are on board already. Its a short term commitment for a huge long term gain. Thanks for your post.

  • excellente bilhadiar de tambo y tucos con ditistamo camemo. orinho a lario y nônetos escremes con movoxu olard!

  • nona

    Thnx Nice work
    Where can I find the source code for this application?

  • thats what i want.
    thanks alott

  • Paul

    This is great. Is there a way to also include the column titles, as a CSV file would do?

  • Pingback: Can Adobe Flex (AIR)  access to desktop address book (Mac and Windows)? | msn messenger smiley()

  • Hello colleagues, how is everything, and what you wish for to say about this paragraph, in my view its genuinely amazing
    for me.

  • Great. Thank you. But I have a problem. Turkish characters in Excel, there is a problem. Would appreciate if you help.

  • Great post. I used to be checking constantly this weblog and I’m
    inspired! Very helpful info specially the last section :
    ) I care for such information a lot. I used to be seeking this certain information for a long time.
    Thank you and best of luck.

  • Hi, only transformed into tuned in to your own website by using Yahoo, determined it is genuinely educational. I am just destined to be mindful intended for belgium’s capital. I most certainly will enjoy in the event you carry on the following later on. Lots of other people are going to be helped through your producing. Many thanks!