How do I save a non-media file (txt, csv) in one of the Shared folders and read it on Android 11+ ( and fix beginners bugs)

Hello to all, my first post, therefore sorry if i dont follow Rules.

I am browsing through the Inventors abilities, and i am genuinely impressed.

To give a backround, it is about 50 Years ago that i put my first program into an motorola 6800 system.... byte for byte clicking switches. smile....

The Inventor ist quite a bit more powerful.... really. Bluetoth anc voice input at hand....

There is just one thing where i fail since 2 weeks: Reading a file from the phone. OK, i got the writing work into /download. the Chromebook ( im am in germany) shows it as /downloads, but in fact only /download works.
But reading ?? nothing. I guess i have spent about 80 % of the time until now only for read/write, alle the rest follows general rules i know from various languages.

So i dont know what all i have to describe to get a hint, i use a cromebook and a motorola phone with android 12.
Writing works on /Download and /documents, i write CSV or TXT files.
I have only one aia file implemented, the Mfile. I am completely unsure what all is possible there.

So, thanks in advance for everything.
Greetings !

See this, regarding the /Download folder on a Chromebook:

and this

What exactly is the goal of your app? Regardless, we should move your question to a new topic.

@Anke, i have read through the file(s) you linked to several times, have found it already before, but i do not really understand what im doing wrong.
I tried the veraious possibilities of filenames, got writing to work in various versions, but never reading.

I do point out that i simply what to store somewehere wher i can download it from the phone into a desktop with excel, to have the data ready there for further investigation. Its a project on medical data where it is not clear where the investigatin leads, so i cannot tell details on this issue before i have aminimum amount of data. For that reason i want to have the data in excel.

That means, in essence, i dont care where i can get the data, it just hast to be a folder i can access for data transfer to PC.
And as i said: I can write to /Documents and to /dowload, either would be suitable for me.
I just are not able to read it back to the app from there. Which would be necerssary to port the later program to show the result on the phone.

Thanks.

If these non-media files (txt, csv) were not created by the app itself, from Android 11+ onwards they can only be accessed using SAF or the app must request and grant MANAGE_EXTERNAL_STORAGE permission.

Sure, sorry, i should have open a new one by myself.

The current goal of the app - at moment - is collecting medical data from me which are input by clicking knobs and using speech recognizer. Its a simplified user interface just for quick and easy input. Its done every few hours, i attach date and time stamp and add the voice input figures and write a csv line from it.
No problms there, happy with it.

We need to see what exactly your app does, which components it uses, and how the data (txt, csv) is stored in the app, or where this data (files) comes from? So post the relevant blocks.

@ Anke, sure i read and found it, all files are created by the app itself using appendtofile.
As i said, writing works well , into /download or /documents, but reading fails whatever i do.

I point out that currently i talk from the AI companion, on my phone i have the same issues: Writing works well, i can see the files and their contents, i dont have tried to read there until now.
I will prepare pictures of my routines, all is very basic, lacking every errorhandling, which i will add later when i am more used to the language.

By that i assume it will be quite easy to overlook whta i have done.
thanks in advance
K.
PS: I had sent another post which has been eaten up by my internet here.
I just want to have writing a file to the phone, on any location useable, wher i can access it to transfer it to a desktop, and can later read itfrom the phone itself for data interpretation and sheets.
So, for now i am content what i have, since there is enough to do collecting data and looking into thm with excel.
But i want to look ahead to the time, whne i may be ready to have that ported to the phone, making reading nexessary.

Here the writing app.
Merging a line and writing it via appendtofile.
Screenshot write

and the reading attempt:
Screenshot Read

all very basic, no error handling i know of.
I will add that later, at moment the app is my use only.

This is not all the program, there is initialization and parallel writing rotines as well.
Th e ask for permission block has been integratet in the reading block, i had pulled it out for testing.
Again, my first goal is to get that working on cromebook only, after that ill try to put taht to a phone. the writing works there, as i said.

Yo see the different paths for reading , i tried them, as well as the one in the Append app.

The File component needs/uses a relative path, so
/Documents/text.txt (FileScope = Shared or Legacy). My Mfile extension uses a full path: file:///storage/emulated/0/Documents/text.txt.

Ahh.. hmmm... ill check that.
On that Mfile extension, i not really understanding the view of that mfile extension. I found that, loaded into the MIT app , but i am not well aware how to use it and what its does.
is the functionality automatically implemented into the App inventor, or have i to do something additional ?
For instance, ist Mfile providing a different reading block to "Readfrom". something or what ?
Thanks

No difference. doesnt read.

btw:
file:///storage/emulated/0/Documents/text.txt or
/storage/emulated/0/Documents/text.txt ??

With my MFile extension:

I do not get the "mfile" procedure offered, i see only the "file" procedures. Looks something is wrong with the Mfle implementation.
Do i need tge mfile ?
What do i have to do it to implement the aia file ? I just downloaded it and put it inte the exttension menue.

mfile pic

Drag it onto the screen in the Designer.

Woa. Sometimes easy things in life are so difficult.....

The File component has still a bug, when you save a text file in one of the Shared folders and try to read it. This was one of the reasons why it created the MFile extension.

I've moved the topic to a new one. Perhaps you'd like to adjust the title...

Bingo. It worked.

Had to us Mfile1.gettext as well ( chuckle)

So many thanks !!