Save Dictionary locally and share the locally saved file

As the above topic says, I have a dictionary which I want to convert to an Excel File preferably (xlsx), save it locally in user’s device and then prompt a share option for the same file. Also every time it must check that if the file already exists in the device then app must delete the existing file and create a new file to share it. I tried searching for the same in Community but couldn’t found anything which shows how to store a dictionary as an Excel File. Below is an attached set of blocks which is followed by the error. Any help would be appreciated (preferably example of Blocks image). TIA :slight_smile:

error

you forgot to create an empty file before using the Append To File method
Taifun

2 Likes

@Taifun The documentation says it will automatically create a file it isn’t available. Also it would be great if you can provide me with Blocks, if I’m wrong. :sweat_smile:

@Taifun Updated the code to this. Now when I am checking for the file in File Explorer, the new file is being created everytime along with the data but the error is still the same and share dialog box is not opening.

Solved my problem with this! THANKS :grin:

the documentation should be correct…
my first guess was wrong… you might want to find out, which blocks gives the error message then…

my next guess is the ShareFile method…
try a full path to the file,
file:///storage/emulated/0/Delhi.csv
or
/storage/emulated/0/Delhi.csv

Taifun

1 Like

This actually worked for me :slight_smile: And thanks for your help :smiley:

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