I’m trying to write a CSV file that a user can access/share.
The basic process I’m following is:
- Prep the data
Write file module - on Android, I can write the file to
systemVars.fileSystem.directories.android.downloads and it works fine
- On iOS, I write the file to
This works, but it puts the file in a directory the user can’t access. Is there a way to put it directly in Downloads?
I tried using the
Export to Downloads module (is this what it’s for? The docs are sparse), but that module doesn’t appear to be doing anything. I use
Get file/directory info to get the File object to pass to
Export to Downloads and I attached alerts to both outputs (success and error), but nothing gets triggered at all.
Bumping this back up bump
Hi, I have the same issue today with the runtime 4.5.7 on Android 12 on a Galaxy Note 20 Ultra with the SAP AppGyver Preview app (I didn’t try with the APK yet).
Here is my workflow:
My “Write file”:
My “Export to downloads” just takes in input the output of “Write file”:
And the JS code that generates the CSV just in case:
Everything succeeds because I can see the toast “Export réussi…” on the right of my workflow, but I don’t see any file exported in my Downloads folder (or in any folder that I can access).
Last year when I worked on this app, I was just able to use “Write file” and it wrote directly to my Downloads folder.
But today, this doesn’t work anymore because it looks like the variable
systemVars.fileSystem.directories.android.downloads that should point to
/storage/emulated/0/Download according to the documentation now points to a private folder of the app as I witnessed when I tried to write the file to it:
Actually, I was able to use only “Write file” to write the file to the “Downloads” folder of the device.
I just replaced the variable
systemVars.fileSystem.directories.* with a hard-coded path
/storage/emulated/0/Download and I can now see the file in the “Downloads” folder.
So it looks like:
- The documentation of
systemVars.fileSystem.directories.* is outdated.
- Using absolute hard-coded paths works.
My workflow now looks like this:
And my “Write file” has this path:
"/storage/emulated/0/Download/" + outputs["Get record"].record.name + "-" + NOW("YYYY-MM-DD-HH-mm-ss") + ".csv"
Hope it helps someone else.
Indeed, your solution seems to work on Android (which wasn’t even having this problem when I first posted…haha.)
My original thread was about iOS though - have you gotten it to work there?