Created
September 6, 2023 05:27
Compare Two Excel (XLS, XLSX) Files in Java using Cloud API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configuration configuration = new Configuration(MyClientId, MyClientSecret); | |
CompareApi apiInstance = new CompareApi(configuration); | |
FileInfo sourceFileInfo = new FileInfo(); | |
sourceFileInfo.setFilePath("source_files/word/source.xlsx"); | |
FileInfo targetFileInfo = new FileInfo(); | |
targetFileInfo.setFilePath("target_files/word/target.xlsx"); | |
ComparisonOptions options = new ComparisonOptions(); | |
options.setSourceFile(sourceFileInfo); | |
options.addTargetFilesItem(targetFileInfo); | |
options.setOutputPath("comparison/sample_excel/result.xlsx"); | |
ComparisonsRequest request = new ComparisonsRequest(options); | |
Link response = apiInstance.comparisons(request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// api initialization | |
FileApi apiInstance = new FileApi(clientId, clientSecret); | |
// create download file request | |
DownloadFileRequest request = new DownloadFileRequest("comparison/sample_excel/result.xlsx", "", null); | |
File response = apiInstance.downloadFile(request); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String clientId = "APP_SID"; | |
String clientSecret = "APP_KEY"; | |
String myStorage = ""; | |
Configuration configuration = new Configuration(clientId, clientSecret); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// api initialization | |
FileApi apiInstance = new FileApi(clientId, clientSecret); | |
// input file | |
File fileStream = new File("C:\\Files\\source.xlsx"); | |
// create file upload request | |
UploadFileRequest request = new UploadFileRequest("source.xlsx", fileStream, myStorage); | |
// upload file | |
FilesUploadResult response = apiInstance.uploadFile(request); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment