Please help reading file

My app wites a csv file in a pre-defined folder on external memory (sdcard).

Name of the file is composed of date and time from the system (example: 2020-10-01- 12:24:41-Data.csv).
The file is saved alright.

When I want to "load" file, I use ActivityStarter to choose the files. I have problem how to specify the name and path of the file.

Tried several codes, but still unsuccessful.

Any help is really depreciated.
Sirous


how do you write that file?
are you talking about an external (removable) sdcard or an internal (emulated) sdcard?

you might want to try the file extension and its FileList method
see also the notes below the Copy method...
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Its not removable. I'm sorry I made a mistake to write "external' in the original post. It is internal sdcard.

Could you pls provide an example?

see the Jukebox examle here App Inventor Extensions: File | Pura Vida Apps
Taifun

What does "load file" mean?

If you only want to read it:
grafik

Thank you. But what if I have saved the file beforehand. What would be the "fileName" like?

/test.cvs

The File component uses / needs the relative path.

See also here:

https://community.appinventor.mit.edu/t/solved-web-component-not-saving-files-to-asd-in-companion/16851/6?u=anke

This might better show where I have problem with:

as already suggested

Taifun
PS: the correct mime type for csv files would be text/csv

Yes, it made things a little better.

In that example (jukebox) you choose a random music file. But I dont want random selection; I want the file selected by user.

Returns this error:
Bad arguments to -
the arguments: , [239],[/storage/emulated/0/test_folder/number_1.csv]

what you could do is to use the FileList method to get a list of all csv files of a given directory
then display these files in a listpicker and let the user select a csv file

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Try this:

List is empty :cold_sweat:

Check your blocks. It works fine for me.
And post a test aia.

Of course, it should be csv in my blocks.

Check this aia: listCsv.aia (32.5 KB)

1 Like

It works, thank you.

Sirous