How do I export data in a systematic way?

  • Hi,

    I want to export data that I stored in array in a tabular form to PDF or something similar to that.

    Let's say a user has cleared ten levels. The array stores Level number, score, lives, time spent to clear the level.

    I should be able to export the data in the following way.

    Level Number Score Lives Time Spent (hrs)

    1 50 5 0.2

    2 90 3 0.35

    3 110 2 0.41

    4 180 6 0.75

    5 230 4 1.20

    so on

    Is there any way to export this data in a tabular form? Export can be downloading file with these details.

    Can anyone help.

    Thanks in advance.

  • The easiest way is to export it in plain text format as comma-separated values. CSV files can be opened with Excel, Google Spreadsheets and some other software.

  • dop2000 That's a good idea but how do we do it here in Construct 3? Any idea on this?

    Also, I would like to provide the export option to the users. They export the data for their reference. Not everyone can understand the usage of CSV files. Again, they will have to use Excel or Google Sheets and reorganize it.

    I'm thinking to provide the data in ready-made format. They just need to export that's all. Data will be provided in a systematic format.

    Any idea on how to achieve this?

  • dop2000

    I found your post on exporting data to Google Sheets.

    construct.net/en/tutorials/sending-data-from-construct-23-to-google-spreadsheet-1447

    Does it help the user to export the data to their Google Sheets?

  • Excel natively opens CSV files, they even have Excel icon when MS Office is installed.

    Exporting to CSV is easy, you simply build a string (put all values with commas and line breaks into text variable) and do "Browser invoke string download".

    .

    Not sure if sending to Google Spreadsheet will work in your case. It's supposed to send data to one table, I don't think you can't create a separate sheet for each user.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000 Cool man. Thanks for the tip on CSV. I will surely try that.

    I hope we have any other turn around for exporting data into PDF or something like.

  • Excel natively opens CSV files, they even have Excel icon when MS Office is installed.

    Exporting to CSV is easy, you simply build a string (put all values with commas and line breaks into text variable) and do "Browser invoke string download".

    .

    Not sure if sending to Google Spreadsheet will work in your case. It's supposed to send data to one table, I don't think you can't create a separate sheet for each user.

    Could you please give me a detailed instructions on exporting to CSV and downloading? I'm able to set the values to a global variable but the download function is throwing an error.

  • It's a single action - "Browser invoke download of string", string is your text variable, MIME type "text/text".

    What error do you get? Please post your code.

  • dop2000

    Events

    Error

  • You need "Invoke download of string"

    Also, you can't use "Add to" with text variables, it only works with numbers. You need to use concatenation operator & :

    Set DetailedReport to DetailedReport & .....

  • Also, you should probably build your string like this:

  • dop2000

    Tired that as well. I'm still getting the error. Not sure where I'm missing.

  • works for me:

    https://www.dropbox.com/s/l9h6wv3t4x9amhz/ExportToCSV.c3p?dl=0

    I used a wrong function. Now, it is working. Thanks alot for your support and valuable time. :D

  • dop2000 One more thing

    Is there a way we could download the file on mobile apps? This function doesn't work on Android as it is a browser function.

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