How do I append results of text boxes to a local excel file

0 favourites
  • 3 posts
From the Asset Store
Over 2700 files with all the colour combinations from a 15 colours palette!
  • I have a layout with several text boxes and drop down menus as well as a submit button. How would I go about setting up the event sheet to send all the data from those fields to an excel spreadsheet that could be appended each time I filled out the form?

    Also, is there a way to open the contents of that file from within another layout?

  • https://en.wikipedia.org/wiki/Microsoft ... le_formats

    Try formatting your data into an xml spreadsheet that looks like the one on the site (just with your data and layout).

    How you could go about this?

    (I only have Libre Office, so I am using this):

    1) open LibreOffice Calc

    2) fill your Layout. The fields that should be filled with your data later on, you can fill with a unique placeholder. Let's say you use %sub1%, %sub2%, %sub3% and so on for different fields. Now you save that as Excel 2003 xml. You should see a format similar to the one on the linked webpage.

    3) Load the file contents into your construct 2 project. (add to project files, request the project file with ajax -> save the contents into a variable; or if you want to, you could also skip the adding of the file to the project files and copy the contents of the file from a text editor to a variable and be done with it; care: you'd need to replace all " to ' in the xml-file)

    4) Now to filling those values: use the replace function. Say your value for %sub1% is "foo" Then you would do: replace(filecontents, "%sub1%", "foo")

    5) use the Browser object and invoke download of a string, string = filecontents, mimetype = "application/xls", filename = "yourexcelfile.xls"

    done

    example:

    https://copy.com/v34AQljxsEd371u6

    Opening the contents from that file from another layout can be done with regex, but it will require knowledge of regex (the more complex the file is, the more difficult it will be).

    If it's the same project and you expect the person to open it on the same computer, maybe you could use local storage. Or you put your data into an array and save the array as json (browser string download again) as a second file for the user. This could be loaded very easily into another project through the load json expression.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi mindfaQ,

    This was just what I have been looking to do for dinner time. Thanks

    Do you think this would work on mobile? First year failed but will try again when I can (I tried webview cocoonio).

    Cheers

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)