Please help reading file


The File component uses / needs the relative path.

See also here:

This might better show where I have problem with:

as already suggested

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.


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.


what version of android do you have?

Anke suggested I should merge my question with this topic.
I have an App that I'm updating for Android 10 and 11. It uses external csv database files downloaded from a PC or the internet and changed frequently. The App Inventor 'read' 'write' file functions now use the App-Specific Directory (ASD) and I don't know how to download external data files from my PC or internet to the ASD in my App Inventor App when Android 11 takes over.

I've looked at Ankes AIA, and EFile, and the FileTools function FileListAsync. I had also looked at CopyFile and Copy File Async as my App already has filters for CSV files.
What I don't understand is whether these FileTools functions will still work on external memory for phones that use Android 11 as it doesn't allow File read and write operations to external memory only to Application Specific Directories? How will one read external data files from non Android applications such as EXCEL?

I'd appreciate any advice, Thanks Peter

See here:

I tested on Android 8. Besides, my files are stored on internal sdcard, not removable, on a predefined folder.
The listpicker solution works, although its not ideal.
I tested the code that Anke wrote, with the file extension offered by Taifun.
Thanks to both of them:))

A post was merged into an existing topic: How to download a file to the ASD with any Android version

As I have already noted elsewhere, files can still be stored in the external storage and read from it (on Android 10 & 11), if you do the latter with the EFile extension.
This will work until AI2 targets API 30 or higher.

See also here (and read the full thread):

3 posts were merged into an existing topic: How to download a file to the ASD with any Android version

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.