Android Question Exporting settings/map file to an Excel document

trueboss323

Active Member
Licensed User
Longtime User
I am using KeyValueStore2 to save user settings into the default file. I want to export the map or settings file it creates and be able to open it and manually edit settings in Excel. Then be able to convert it back to the original file format. Is it possible to do that?
 

trueboss323

Active Member
Licensed User
Longtime User
You can read and write to KVS2 and you can read and write to an Excel file. So it is possible to create a B4J program that reads the data from KVS2 and writes to an Excel file and vice versa.

Is it a lot of work to create the program? Could you give an example please ?
 
Upvote 0

nwhitfield

Active Member
Licensed User
Longtime User
How often do you need to do this?

If you use File.WriteMap to create a settings file, you can open that directly in Excel; in the version I have (Mac, 2008), choose File, then Import. Select CSV, and then on the second page of the wizard, set the delimiter to =. You'll end up with two columns, one with the keys, and the other with the values.

To go the other way is a bit fiddlier, because what you'll export is a CSV rather than a settings file; you could probably mangle it back into a settings file using a Word Macro to search and replace (strip " off the start of each line, and change "," to an =, strip " off the end of any line, or something like that). Then you should be able to read it back in using File.ReadMap.

Alternatively, if I were doing this a lot, I'd stick with the same option for exporting, because I wouldn't have to write any code. For importing back to the app, I'd write a bit of code read the CSV file from Excel, do whatever substitutions are necessary, and re-populate the KVS.
 
Upvote 0

trueboss323

Active Member
Licensed User
Longtime User
Although i havent tried your method yet, it might be more convenient to have a B4J program that will automatically do this.
Be more specific.

Do you know how to read from KVS2?

Do you know how to write to an Excel file?

Do you want to implement it as a B4A program?

So I am trying to implement as a B4J program to do the things I mentioned.
 
Last edited:
Upvote 0
Top