We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

JAVA - Json to Excel Title Removal

I have a fairly nested Json object that contains arrays as well.
I have managed to use the JsonLayoutOptions to make the excel fairly accurate using these properties:

JsonLayoutOptions options = new JsonLayoutOptions();

As I am using a template Excel with headers already included I would like a way to not put the key of the JSON as the title of a row value. Is this possible just now? I feel I have exhausted the options above without manually removing rows after the save which isn’t ideal.

Currently the output is like this

1 First name | Last Name | Gender
2 firstName | lastName | gender <–REMOVE
3 Joe | Bloggs | M
4 firstName | lastName | gender <–REMOVE
5 Bill | Gates | M

Any help is appreciated

I have tried the following code with the attached files using latest version Aspose.Cells for Java 19.7.x. Apparently it has created similar output as expected by you. Please give it a try and share your feedback. If it does not fulfill your requirements, please provide your sample code, template file, JSON file, program output and Expected output created by Excel. It will help us to observe the problem and provide feedback accordingly.

Workbook workbook = new Workbook(path + "template.xlsx");
Worksheet worksheet = workbook.getWorksheets().get(0);
// Read File
File file = new File(path + "Test.json");
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
String jsonInput = "";
String tempString;
while ((tempString = bufferedReader.readLine()) != null) {
	jsonInput = jsonInput + tempString; 
// Set JsonLayoutOptions
JsonLayoutOptions options = new JsonLayoutOptions();

// Import JSON Data
JSONUtility.importData(jsonInput, worksheet.getCells(), 0, 0, options);

// Save Excel file
workbook.save(path + "ImportingFromJson.out.xlsx");

ImportingFromJson.out.zip (6.6 KB)
template.zip (6.2 KB)
test.zip (229 Bytes)

I have the same problem, wondering if this get fixed.

@ jimmyboix : please let us know.

Please create a separate thread with your runnable console application, input file, program output and expected output file created by any third party tool for our reference. We will analyze the information and provide assistance accordingly.