Formula Errors

How to Create JSON-Style Text from Cells Using Excel Formulas

Adam DavisAdam Davis Oct 23, 2026 869 views

Question details

The user needs to convert standard spreadsheet data into JSON-formatted text strings by combining header names and cell values using braces, quotation marks, and commas.

How to Create JSON-Style Text from Cells Using Excel Formulas
Product
Excel / WPS Spreadsheet
Device & OS
not provided
Scenario
Exporting or formatting tabular spreadsheet data into JSON objects for web development, API integration, or database transfer.
Observed behavior
The goal state is to have a helper column that automatically generates a valid JSON string representing the data in each row, mapped correctly to the corresponding column headers.
Before you start

Ensure your column headers (row 1) clearly represent the JSON keys you want to generate, and verify that your data contains no unescaped quotation marks that could break the resulting JSON structure.

Solution 1Recommended

Use the Concatenation Operator (&) to Build JSON Strings

Construct the JSON object by using the ampersand (&) operator to join static JSON syntax (braces, quotes, colons) with dynamic cell references.

This method uses absolute references for the header row to act as JSON keys, and relative references for the data rows to act as JSON values. Escaping quotes in spreadsheet formulas requires using multiple double quotes to output a single literal quote mark.

1
Identify your headers and data

Make sure your headers (which will become JSON keys) are located in row 1 (e.g., A1, B1, C1). Your first row of actual data should begin in row 2.

2
Enter the JSON formula

Click on a free cell in row 2 of a helper column. Enter the concatenation formula: ="{\"\"\""&A$1&"\"\"\":\"\"\""&A2&"\"\"\",\"\"\""&B$1&"\"\"\":\"\"\""&B2&"\"\"\"}". Expand this pattern to include additional columns (like C, D, E) by adding more comma-separated blocks before the closing brace.

3
Fill the formula down

Press Enter to generate the JSON text string for the first data row. Select the cell, click the fill handle (the small square in the bottom-right corner of the cell), and drag it down to apply the formula to all remaining rows in your dataset.

Use the Concatenation Operator (&) to Build JSON Strings
Handling quotation marks in formulas: In formulas, a literal double quote inside a text string must be written as multiple double quotes. The sequence \"\"\" evaluates to a single double quote character surrounding your keys and values.
WPS Spreadsheet Solution

Create JSON Data Easily with WPS Spreadsheet

WPS Spreadsheet fully supports advanced text concatenation and string manipulation functions, making it incredibly easy to format standard tabular data into JSON strings for your development or data integration needs.

  1. 1. Open your data file: Launch WPS Spreadsheet and open the workbook containing the tabular data you wish to convert to JSON.
  2. 2. Input the concatenation formula: In a blank column next to your data, type or paste your JSON string concatenation formula using the & operator to join headers and cells.
  3. 3. Drag to apply: Use the fill handle in the bottom-right corner of the cell to drag the formula down, instantly generating valid JSON text for every row in your dataset.
  4. 4. Copy and paste as values: Select the generated JSON strings, right-click to copy them, and choose 'Paste as Values' if you need to export them cleanly to a text editor without the underlying formula.
Seamless compatibility with Microsoft Excel formulas like CONCAT, TEXTJOIN, and the & concatenation operator.Lightweight and fast, effortlessly handling large datasets and complex text formulas without lagging.Free to download and use, providing a familiar tabbed interface for increased productivity.
microsoft office alternative - wps office

Frequently Asked Questions

How do I handle empty cells when creating a JSON string with a formula?

If a cell is empty, the basic formula will output an empty string for that key (e.g., "Key":""). To avoid empty strings or remove the key entirely, you can wrap each key-value pair in an IF function to check if the data cell is blank before concatenating it into the final string.

Can I use the TEXTJOIN function instead of the ampersand (&) operator?

Yes, in modern spreadsheet software like WPS Spreadsheet, you can use the TEXTJOIN function combined with an array to build JSON arrays or objects more cleanly, which reduces the need to write out every single cell reference and comma manually.

Why is my generated JSON string outputting extra quotes when I paste it?

Extra quotes usually occur because the spreadsheet software wraps the cell contents in quotes when copying text that already contains quotes. To fix this, copy your generated JSON cells, use 'Paste Special > Values' into a new column, and then copy that plain text to your external editor.

Is there a limit to how long the JSON string can be in a single cell?

Yes, spreadsheet cells typically have a character limit of 32,767 characters. If your generated JSON object exceeds this length, the formula will return an error or truncate the resulting text.