Convert excel data into json

Hi All,

Hope all are doing good. In applescript, if it possible to convert the excel file data(2 columns) into JSON file and to read the JSON file?

It’s certainly possible, but I think it will take a little coding, it’s not just some built-in command.

Excel has an Applescript dictionary, so you can read the values with Applescript.

You can translate between Applescript Records and JSON with ASObjC or with the free App Store application “JSON Helper.”

You can find the code for the ASObjC method in this thread:
https://www.macscripter.net/viewtopic.php?pid=191475

So I’d read the values, then use Applescript to put those values into a record however you need them, then convert to JSON with one of the above methods.

However, I don’t know what your data looks like. Say you’ve got two columns, one with a key, the next with a corresponding value. Applescript doesn’t like using variables to create keys for records. It can be done with metascripting. Or it might be easier, if it’s simple JSON that’s required, to just build proper JSON format out of your data with Applescript text manipulation, and skip making a record and converting it with an automatic tool.

If you provide a sample spreadsheet, it may be easier for us to see what’s involved. However, probably few users here have Excel, so the reading Excel part you may need to figure out for yourself.