Error message "This is not a structured storage file" whene trying to merge files


To evaluate the use of the aspose cell API in a project, I try to merge two Excel (.xlsx) files into a single file with JAVA and I have the following error message:

Error :

cd C:\Users\ThinkPad\Documents\NetBeansProjects\excelApp; "JAVA_HOME=C:\\Program Files\\Java\\jdk-14" cmd /c "\"D:\\NetBeans-11.3\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Dexec.args=\"-classpath %classpath com.kt.excelapp.MergeExcel\" -Dexec.executable=\"C:\\Program Files\\Java\\jdk-14\\bin\\java.exe\" -Dmaven.ext.class.path=D:\\NetBeans-11.3\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.5.0:exec"
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...
Building excelApp

--- exec-maven-plugin:1.5.0:exec (default-cli) @ excelApp ---
Exception in thread "main" java.lang.IllegalStateException: This is not a structured storage file.
	at com.aspose.cells.zakt.<init>(Unknown Source)
	at com.aspose.cells.zzm.b(Unknown Source)
	at com.aspose.cells.zzm.<init>(Unknown Source)
	at com.aspose.cells.zaun.a(Unknown Source)
	at com.aspose.cells.zaun.a(Unknown Source)
	at com.aspose.cells.CellsHelper.mergeFiles(Unknown Source)
	at com.kt.excelapp.MergeExcel.main(
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(
	at org.apache.commons.exec.DefaultExecutor.execute(
	at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(
	at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(
	at org.codehaus.mojo.exec.ExecMojo.execute(
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(
	at org.apache.maven.DefaultMaven.doExecute(
	at org.apache.maven.DefaultMaven.doExecute(
	at org.apache.maven.DefaultMaven.execute(
	at org.apache.maven.cli.MavenCli.execute(
	at org.apache.maven.cli.MavenCli.doMain(
	at org.apache.maven.cli.MavenCli.main(
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.base/java.lang.reflect.Method.invoke(
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(
Total time: 8.155 s
Finished at: 2020-04-20T19:38:24+01:00
Final Memory: 7M/30M
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (default-cli) on project excelApp: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1]

This is the java code

package com.kt.excelapp;

import com.aspose.cells.CellsHelper;
import com.aspose.cells.Workbook;

public class MergeExcel {
    public static void main(String[] args) throws Exception {
		// ExStart:1
		//String dataDir = Utils.getSharedDataDir(MergeFiles.class) + "CellsHelperClass\\";

		// Create an Array (length=2)
		String[] files = new String[2];
		// Specify files with their paths to be merged
		files[0] = "c.xlsx";
		files[1] = "w.xlsx";

		// Create a cachedFile for the process
		String cacheFile = "test.txt";
		// Output File to be created
		String dest = "output.xls";

		// Merge the files in the output file
		CellsHelper.mergeFiles(files, cacheFile, dest);

		// Now if you need to rename your sheets, you may load the output file
		Workbook workbook = new Workbook("output.xls");

		int cnt = 1;

		// Browse all the sheets to rename them accordingly
		for (int i = 0; i < workbook.getWorksheets().getCount(); i++) {
			//workbook.getWorksheets().get(i).setName("Sheet1" + cnt);
		// Re-save the file"MergeFiles-out.xls");
		// ExEnd:1


You’ll find attached my two (13.1 KB)

Can you help me to fix this problem ?

Thank you for your help and support.



Thanks for the details and stacktrace.

Please zip your source files and paste your sample code (runnable) to reproduce the issue, we will check it soon.


Thank you for your help.

I just updated my message, please check.



Thanks for the template files and sample code.

After an initial test, I am able to reproduce the issue as you mentioned by using your sample code with your template files. I found an exception “java.lang.IllegalStateException: This is not a structured storage file” when merging Excel files. I have logged a ticket with an id “CELLSJAVA-43168” for your issue. We will look into it soon.

Once we have an update on it or we figure it out, we will let you know.

Thank you for your support and reactivity :ok_hand::+1:

You are welcome.

This method is used to merge large xls files to xls file, it does not support merging xlsx files.
Please use workbook.Combine() method to merge them and let us know your feedback.

Yes :slight_smile: I did it, I combined the two files by using the methde Workbook.combine();

    Workbook file1 = new Workbook("c.xlsx");
    Workbook file2 = new Workbook("w.xlsx");

Thank you for your support, very helpful.

You are welcome.

The issues you have found earlier (filed as CELLSJAVA-43168) have been fixed in Aspose.Cells for Java v20.5. This message was posted using Bugs notification tool by ahsaniqbalsidiqui