Is there a simple way to convert a simple excel sheet to a JSON file?
For example the source sheet could look like:
A B
1 firstName age
2 Alice 22
3 Bob 33
and the saved JSON:
[{firstName: 'Alice', age: 22}, {firstName: 'Bob', age: 33}]
Best Answer
I've combined jcbermu’s answer and JanHudecek’s answer with a UTF-8 version (snippets found here) which keeps accents and other Unicode goodness.
It saves the file beside the active workbook file but with the
.json
file extension. It's fast. It can be easily formatted in VS Code (Shift+Alt+F).To use it, hit Alt+F11 to get to the VBA code editor, open the code for your active worksheet, then paste it into the code window. Hit F5 to run.