Blog
Wild & Free Tools

Excel VBA to JSON Macro vs Free Browser Tool — Which Is Faster?

Last updated: March 7, 2026 6 min read

Table of Contents

  1. The VBA Approach
  2. When VBA Makes Sense
  3. When Browser Tool Is Better
  4. A Working VBA Alternative
  5. The Date Problem in VBA JSON
  6. Frequently Asked Questions

There are two types of Excel users who search for "excel to json vba": people who want to write a VBA macro to automate the conversion, and people who copied a VBA macro from Stack Overflow and it's not working. This guide addresses both — but starts with the question you should ask first: do you actually need VBA for this, or is a no-code browser tool faster?

The VBA JSON Macro Approach

VBA (Visual Basic for Applications) can produce JSON from Excel data, but Excel does not have a built-in JSON serializer. You have two options:

Option 1 — Write a JSON serializer from scratch. Loop through cells, build strings, handle escaping for special characters. Works, but is fragile — missed comma, wrong escape sequence, and the output is invalid JSON that silently breaks things downstream.

Option 2 — Use a VBA JSON library. The most popular is VBA-JSON (github.com/VBA-tools/VBA-JSON). You import the module, then use JsonConverter.ConvertToJson(). This is more reliable but requires importing the module into every workbook where you need it.

Here's a minimal VBA macro using VBA-JSON:

Sub ExportToJSON()
    Dim ws As Worksheet
    Dim arr As New Collection
    Set ws = ActiveSheet

    Dim lastRow As Long
    lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row

    ' Build array of objects
    ' ... (30+ more lines of code)

    ' Write to file
    Dim fso As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    ' ... (more code)
End Sub

The full macro is typically 50-80 lines. Debugging VBA string handling takes time. Macro-enabled files (.xlsm) often trigger security warnings when shared.

When VBA Actually Makes Sense for JSON Export

VBA is the right choice in specific situations:

Sell Custom Apparel — We Handle Printing & Free Shipping

When the Browser Tool Is the Better Choice

For the majority of "I need to convert this Excel file to JSON" situations, the browser tool wins on every practical dimension:

FactorBrowser ToolVBA Macro
Time to working conversion10 seconds1-4 hours
Debugging requiredNoneOften yes
Works for recipientsAny browserNeeds xlsm + macro trust
Handles type detectionAutomaticManual logic
Date handlingAutomaticNotoriously tricky in VBA
JSON validity guaranteedYesDepends on your code

If You Must Use VBA — The Simplest Reliable Approach

If you genuinely need VBA, here's the most reliable minimal approach — using XMLHTTP to call a conversion service, or exporting to CSV first and then converting:

Excel CSV save + browser conversion (simplest hybrid):

  1. In VBA, save the active sheet as CSV: ActiveWorkbook.SaveAs Filename:="output.csv", FileFormat:=xlCSV
  2. Then open the CSV in the CSV to JSON converter for the actual JSON conversion.

This gives you programmatic control over the export step while avoiding the need to write a JSON serializer in VBA.

For direct .xlsx-to-JSON conversion in one click, use the Excel to JSON converter — no VBA required.

Dates: The Biggest VBA JSON Pain Point

If you've debugged a VBA JSON macro, you've almost certainly hit date issues. VBA represents dates as Date type internally, but JSON has no date type — you must serialize as string. And Excel's Date type doesn't have a built-in ISO 8601 formatter, so you end up with custom code like:

Format(dateValue, "yyyy-mm-dd")

This works for date-only cells. For datetime cells, you need to handle both the date and time components. And if your cells are stored as numbers (date serials), you need to convert those first with CDate().

The browser tool handles all of this automatically. For the details on how date conversion works, see our guide on Excel to JSON date format issues.

Try It Free — No Signup Required

Runs 100% in your browser. No data is collected, stored, or sent anywhere.

Open Free Excel to JSON Converter

Frequently Asked Questions

Is there a free VBA-JSON library I can use?

Yes — VBA-JSON by Tim Hall (github.com/VBA-tools/VBA-JSON) is the most widely used. It handles serialization and deserialization. You import the module into your workbook and use JsonConverter.ConvertToJson(). Free and open source.

Can VBA produce nested JSON?

Yes, but it requires manually building Collection and Dictionary objects to represent the nested structure before serializing. It is significantly more complex than flat JSON export. Python is generally easier for nested structures.

What security warnings do users see with macro-enabled Excel files?

When recipients open an .xlsm file, Excel shows a "Macros have been disabled" banner by default. They must click "Enable Content" to run the macro. In some corporate environments, macros are disabled entirely and cannot be enabled by the user.

Can the browser tool be triggered from VBA?

Not directly. But VBA can launch a browser to a URL using the Shell command or CreateObject("InternetExplorer.Application"). For automation, using Python or n8n is more practical than trying to chain VBA with a browser tool.

Andrew Walsh
Andrew Walsh Developer Tools & API Writer

Andrew worked as a developer advocate at two SaaS startups writing API documentation used by thousands of engineers. He brings technical precision to his coverage of developer tools and data format converters.

More articles by Andrew →
Launch Your Own Clothing Brand — No Inventory, No Risk