Converting JSON to a Spreadsheet

GroupDocs.Conversion allows converting JSON data into spreadsheet formats like XLSX, effectively treating the JSON file as a data source for the spreadsheet. This functionality is achieved using the SpreadsheetConvertOptions class.

Convert JSON to Spreadsheet

Here’s how you can achieve this in Java:

import com.groupdocs.conversion.Converter;
import com.groupdocs.conversion.options.convert.SpreadsheetConvertOptions;

public class ConvertJsonAsDataSourceToSpreadsheet {
    public static void convert() {
        // Initialize the Converter for the input file
        try(Converter converter = new Converter("sample.json") {
            // Set up SpreadsheetConvertOptions
            SpreadsheetConvertOptions options = new SpreadsheetConvertOptions();

            // Perform the conversion
            converter.convert("converted.xlsx", options);
        }
    }

    public static void main(String[] args){
        convert();
    }
}

sample.json is sample file used in this example. Click here to download it.

converted.xlsx is converted XLSX file. Click here to download it.

This flexibility allows you to transform JSON data into well-organized spreadsheets tailored to specific requirements.