Export list data into CSV Form

Good Day
I have this application and close to end and

All information is save in Listpicker but I need to export it as CSV file.
I did search and try for the code I found on Youtube: App Inventor2: Exports in CSV format - YouTube

But there is no file created in my storage.
I see other topic similar to mine but it is in the .text form
Attach here is the code.
11


Thank you.

  1. You do not really need to save the Full_Names to a list and tinydb, because you can use the taglist for that (unless you are saving other tags as well)
  2. Use the listpicker for display purposes only, save the list data in the tinydb to your csv file (at the moment you are only saving the listpicker button label text, not a list at all)

Something like this

1 Like

Thank you for the reply Sir TIMAI2
yes it works I did save my output into .CSV file but I can only do one file is there a way to save all files in the in the ListPicker or any records save in the TinyDB.
Thanks

Yes you can use a for each loop on the tags...

image

1 Like

Still problem persist I can only save One file at a time..

I just want all of data in TinyDB or in ListPicker be save as .csv or even .txt
In the first message: The link I share above he uses Label to store the values and successfully exported it all in CSV file. I follow the procedure but fail to do it. What do you think is the problem sir.

These blocks will save each entry to the tinydb, and then allow the user to save all entries in the taglist to File. Make sure when testing in companion, you clear your tinydb before adding entries.

image

image

1 Like

It sounds like you want just one file, with a name like EveryOne.CSV ?

to do that try like this:

image

If you want to append to file each time you create a new record, then like this:

1 Like

I tried this code sir TIMAI2 but there are no result in saving my data into my storage.

Are you saying that a csv file is created in your application specific directory, but it is empty, or that no file is created, or something else ?

You may need to post images of your relevant blocks or your example aia project file.

The code is in AdminSpace (Screen)
I am using btn_export_csv and ADD - for practice and not to change the other codes. Attach here is my aia project file sir TIMAI2
Mobility_and_Contact_Tracing_App.aia (2.7 MB)

Another problem that I find to solved Sir TIMAI2 same Project VisitorsSpace (Screen).
I am using your TaifunFile extension and QRCodeCreate1 extension for this. If connected thru AI Companion the QR code is generated and saved in Gallery. While If I Install via .apk: "Error 707 Cannot Open File" shows.. What might be the problem.
Thank you. Do I need to create another session for this...

Try changing your buttonExportData blocks to this:

(assumes you have selected a record from the listpicker)

  1. It is not my TaifunFile extension, it is @Taifun s
  2. You are aware that you cannot create/save a country or international valid qr code ?
  3. For your QR Code Move, you will probably need to use the File component Move block, something like this (not tested)

Still no CSV file record on my storage device.
I follow the code and selected a record in listpicker but no result.
I am currently using sharing then save as text. but i think it is more appropriate to save it as CSV.

I do not understand what you mean by this ?

Sorry for the confusion
I try this Code the encounter this error "argument is neither Class nor Type"
but the QR-Code is Generated and no QR-Code in the gallery ....

Sorry sir what I mean is I tried to follow your codes but still no CSV file in my storage device.
I even selected the output in the listpicker.

Did you Add a tag and its values to the tinydb before trying to export?
Was that data in the tinydb (use getValue to check in companion)
Where/how are you looking for your csv file ?


Here sir..