Export Data to Excel File

In this example i want to show you how to write data to Excel file from a Flex application. I use as3xls library and FileReference.save() method in Flash Player 10.

18 Comments


  1. Marks
    January 22, 2010 at 9:03 pm

    I try the demo.the save window only has “books” when I click “save as XlS”,

    Why extension “xls” missing,any way to fix this.

    Thanks

    Mark

  2. Mariush T.
    January 22, 2010 at 9:45 pm

    I assume that you’re using Windows.
    Your windows settings are set to hide extensions for known file types.

    Set your settings to show extensions and you’ll see ‘.xls’ in the ‘Save As’ window.
    Show or hide file name extensions

  3. Srinivas
    February 22, 2010 at 4:06 pm

    Hi,

    I am using as3xls to download excel file from Grid, but I am not able to use FileReference.save() in my FlexBuilder. It says unable to locate undefined method. I am using Flex SDK3.5
    Any one please help me?

  4. Srinivas
    February 22, 2010 at 4:08 pm

    Hi Mariusz,

    Can I use straight away as3xls in my lib file. Do we need to do anything else, because i am unable to work with this .swc file.

    Thank you

  5. Mariush T.
    February 22, 2010 at 9:57 pm

    FileReference.save() method is available only in Flash Player 10. You have to set Flex builder compiler settings to Flash Player 10. Follow this link http://blog.everythingflex.com/2008/05/20/using-flash-player-10-within-flex-builder/

  6. Srinivas
    February 23, 2010 at 11:41 am

    Hi Mariush T

    Thanks for your response. I have done same provided in link. FileReference.save() is working fine and I could able to download excel file. But when I use Flash player 10 in my browsers, I could not able to see drag and drop features in my application which worked well in flash 9. It shows the following error:
    [BlazeDS]Unknown AMF type ’17’.

    Do you know any solution for this kind of problem.

    Thanks in advance

  7. Srinivas
    February 23, 2010 at 5:45 pm

    Hi Mariush,

    I have un-installed and re-installed but not works for me.
    I am giving complete exception. See if you can help me out.

    [BlazeDS]Unknown AMF type ’17’.
    flex.messaging.io.UnknownTypeException: Unknown AMF type ’17’.
    at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:219)
    at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:132)
    at flex.messaging.io.amf.Amf3Input.readScriptObject(Amf3Input.java:473)
    at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:153)
    at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:132)
    at flex.messaging.io.amf.Amf3Input.readArray(Amf3Input.java:371)
    at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:157)
    at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:132)
    at flex.messaging.io.amf.Amf3Input.readScriptObject(Amf3Input.java:473)
    at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:153)
    at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:132)
    at flex.messaging.io.amf.Amf0Input.readObjectValue(Amf0Input.java:135)
    at flex.messaging.io.amf.Amf0Input.readArrayValue(Amf0Input.java:326)
    at flex.messaging.io.amf.Amf0Input.readObjectValue(Amf0Input.java:139)
    at flex.messaging.io.amf.Amf0Input.readObject(Amf0Input.java:95)
    at flex.messaging.io.amf.AmfMessageDeserializer.readObject(AmfMessageDeserializer.java:226)
    at flex.messaging.io.amf.AmfMessageDeserializer.readBody(AmfMessageDeserializer.java:205)
    at flex.messaging.io.amf.AmfMessageDeserializer.readMessage(AmfMessageDeserializer.java:125)
    at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:114)
    at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:278)
    at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$7e16147a.service()
    at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:101)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:595)

  8. Mariush T.
    February 23, 2010 at 9:38 pm

    I don’t know what causes your problem.

  9. Arnab
    March 17, 2010 at 9:07 am

    Hi Srinivas,

    I thnk u r getin Unknown AMF type ‘17′ bcoz of changing ‘required flash player version’ to 10.

  10. Nuwan
    May 5, 2010 at 10:35 am

    Thank you for the nice post, worked well!

  11. Christopher
    June 5, 2010 at 6:22 pm

    Thank you. But i got problems with utf-8 font when exporting. Some characters display incorrectly. I don’t know how to get rid of it.

  12. Daniel
    June 12, 2010 at 3:50 am

    Hi,
    Thanks for sharing.
    It seems that as3xls could not support export data to excel file very well.I mean that it could not implements the functionality about export data to excel file with formula and
    format.I would appreciate that if you could give some suggestion
    about how to implements that functionality.

    Best Regards,
    Liu,Meng-meng

  13. smith
    July 22, 2010 at 7:32 am

    Hi.

    thank u for this post..
    I need to export multiple sheet excel file.Is it possible with as3xls?

    Smith

  14. Mariush T.
    July 22, 2010 at 8:11 am

    I think it is possible. Look at the http://code.google.com/p/as3xls/wiki/Tutorial

  15. smith
    July 23, 2010 at 10:21 am

    hi..
    thankz for your response…

    I tried to export multiple sheets.But the saveToByteArray() method exports only the first sheet :(

    Smith

  16. nona
    October 13, 2011 at 2:58 pm

    Hi,
    Thanks for sharing.
    i use this script in android and its work perfectlly
    but in ipad dont work filere.save
    can u help me
    thnx

  17. Mariush T.
    October 17, 2011 at 10:40 pm

    Hi,
    I don’t have the iPad, so I won’t be able to help you, sorry.
    Best regards

Leave a comment