Help with transfer from csv file to tinydb

hello i want to transfer data from my csv file to tinydb and show it in listpicker i did it, but i don't want to download the file every time i open the page want to save it in tinydb , i need help with that.

I can't see any tinydb blocks?

What you need to do is set the csv data to a tinydb tag, then load this tag at screen initialise to a list. Only if the tag has an empty list should you download the csv.

ok i will try it


(Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.



HelpApps_1.aia (180.7 KB)
Here is the file

Abg can you help me , i have add the file

Pardon the delay, I have some quick observations.

In this download from the web doc in Screen VSD2 (you could have mentioned which screen out of the dozen), I notice you have some rows that will break CSV conversion. They start with '•' around line 391. You might avoid that by running the downloaded text through a replace text block, replacing that character with a space (if indeed it breaks CSV).

I also notice you have multiple TinyDBs, but you don't use different NameSpaces, so they share the same tag/value pairs.


Maybe use 'VSD' for the NameSpace ?

...continuing to search for which Screen(s) were giving you trouble ...

I see in your thermostats(?) screen, you also do a download and csv conversion:

I am guessing column 2 (ETN1000/H2/WS/BL) is your unique key?

So you need yet another NameSpace, for thermostats, where you would use column 2 of each row as the tag for that row, storing the 5 item list as the value.

I recommend trimming the end of the sheet, to avoid needing extra code to filter the partially blank rows.

Going back to the VSD download, I notice your unique key is in column 2, and every row has 'ABB' in column 1.

But the multiline nature of some rows might need a special purpose parse of the text using the Split At 'ABB' text block to get rows, then for each row a text Split at ',' to separate out list items from that row.

I ran your app, and the parsing of the downloads was working okay, so if all you want is to avoid downloads, just take your CSV text and store it in Media .txt files and use a File Read instead of a Web Get. Since you store the full tables under single tags, you are not using the full power of TinyDB anyway.

But there remains one question.

What happens when you need to update those tables?

Here's a version of your app with web download replaced by Assets file load:

HelpApps_1 (1).aia (211.4 KB)

This version loads the VSD file into TinyDB Namespace VSD just on first load, to make lookup faster on subsequent runs.
HelpApps_1 (2).aia (195.3 KB)

P.S. You will also need to follow the Screen switching advice in

to avoid run-time chometz.

Thank you for your help , i will do that and send you the result

ABG in your code does the file need to be in the phone

It depends on how much it bothers you to have your spreadsheet downloaded on the first run.

I took the extreme case of doing without the sheets entirely.

The logic is the same either way, only the source differs.

if i dont want to download the file but only the data i need to downlaod it to a file or i can downlaod it steragth in to the tinydb.

yes you can
in the Web.GotText event you get the data as table in csv format
just convert it into a list of lists using the list from csv table block and store the complete list of lists in one tag in TinyDB