How to Create JSON-Style Text from Cells Using Excel Formulas
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.

- 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.
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.
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.
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.
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.
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.

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. Open your data file: Launch WPS Spreadsheet and open the workbook containing the tabular data you wish to convert to JSON.
- 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. 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. 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.

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.




