ods to excel

Convert ODS to Excel workbook conversion with C# .NET.

OpenDocument Spreadsheet (ODS) and Microsoft Excel (XLSX) are two widely used spreadsheet formats, each offering unique advantages. ODS, an open-source format, is primarily used with LibreOffice and OpenOffice, providing flexibility and interoperability. However, by converting ODS to Excel ensures seamless data handling, better support for complex formulas, and enhanced collaboration within professional environments.

REST API for ODS to Excel Conversion

GroupDocs.Conversion Cloud SDK for .NET simplifies this process by providing a powerful REST API that enables developers to automate and streamline ODS to Excel conversion in their applications. In this article, we’ll explore how to use GroupDocs.Conversion Cloud SDK to effortlessly convert ODS files to Excel format while maintaining data integrity and efficiency.

The first step in this approach is to install it by searching GroupDocs.Conversion-Cloud in NuGet package manager and click the Install button. Another option is to execute the following command in package manager console.

NuGet\Install-Package GroupDocs.Conversion-Cloud -Version 24.12.0

After the installation, please obtain your personalized API credentials(i.e. Client ID and Client Secret). You may visit this short tutorial explaining the details on how to get the API credentials.

Convert ODS to Excel in C#

In this section, we are going to explore the C# .NET code snippet that can be used to convert ODS to Excel workbook format in the Cloud.

  1. Firstly, create an instance of Configuration class where we pass client credentials as arguments.
var configurations = new Configuration(clientId, clientSecret1);
  1. Secondly, initialize the ConvertApi where we pass Configuration object as an input argument.
var apiInstance = new ConvertApi(configurations);
  1. Now, upload the input ODS file to the cloud storage.
fileUpload.UploadFile(new UploadFileRequest("input.ods", stream));
  1. Create an instance ConvertSettings where we specify the name for input ODS file, the resultant format as xls and the name of the resultant Excel workbook as arguments.
var settings = new ConvertSettings{...}
  1. Lastly, call the ConvertDocumentRequest API to convert ODS to Excel and save the resultant Excel worksheet to the cloud storage.
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings));
// More examples over https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet
// Obtain your API credentials
string clientId = "XXXXXX-XXXXXXXXX-4088-9ca0-55c38f4b7f22";
string clientSecret1 = "XXXXXXXXXXXXXXXXXXXX";
// Create an instance of the Configuration class and initialize it with the Client ID & Client Secret.
var configurations = new Configuration(clientId, clientSecret1);
// Define the value of ApiBaseUrl to set the base url for ODS to Excel conversion API.
configuration.ApiBaseUrl = "https://api.groupdocs.cloud";
// Initialize an instance of the ConvertApi class with an object of Configuration class.
var apiInstance = new ConvertApi(configurations);
// load the input ODS file from local drive
using (var stream = System.IO.File.OpenRead("input.ods"))
{
// create an instance of FileApi
var fileUpload = new FileApi(configurations);
// upload the input ODS to the cloud storage
fileUpload.UploadFile(new UploadFileRequest("input.ods", stream));
// create ConvertSettings where we specify the name of input ODS and the name for resultant XLS file.
var settings = new ConvertSettings
{
StorageName = "default",
FilePath = "input.ods",
Format = "xls",
OutputPath = "converted.xls"
};
// Invoke the ConvertDocument method for ODS to Excel conversion operation.
var response = apiInstance.ConvertDocument(new ConvertDocumentRequest(settings));
if (response != null && response.Equals("OK"))
{
// print success message
Console.WriteLine("The ODS to Excel conversion completed successfully !");
}
}
view raw ods-to-xls.cs hosted with ❤ by GitHub
ods to excel

Image:- Preview of ODS file to Excel conversion.

Export ODS to XLSX using cURL Commands

Converting ODS to Excel (XLSX) using a cURL command provides a simple and efficient way to automate the process through a REST API. By leveraging the GroupDocs.Conversion Cloud API, you can send a cURL request to the API endpoint, specifying the source ODS file and the desired output format. The API processes the request and returns a high-quality Excel file while preserving the original structure, formulas, and formatting.

The first step in this approach is to generate a JWT access token. Then, execute the following cURL command to export ODS to XLSX format. After successful conversion, the resultant Excel workbook file is stored in the cloud storage.

curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{  \"StorageName\": \"default\",  \"FilePath\": \"{inputMPP}\",  \"Format\": \"xls\",  \"OutputPath\": \"{resultantXLS}\"}"

Please replace inputODS with the name of input ODS file, resultantXLSX with the name of resultant Excel workbook and accessToken with a personalized JWT access token.

  • If you want to save the resultant Excel file to local drive, please try using the following cURL command:
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{  \"StorageName\": \"default\",  \"FilePath\": \"{sourceFile}\",  \"Format\": \"xls\"}" \
-o "output.xls"

Free ODS to Excel Converter

We recommend using our free and lightweight ODS to Excel Converter App, as it enables you to explore the unique capabilities of GroupDocs.Conversion Cloud within a web browser.

mpp to xls conversion app

Conclusion

By leveraging GroupDocs.Conversion Cloud SDK, you can automate ODS to Excel conversion effortlessly while ensuring high accuracy and maintaining data integrity. Whether you’re handling batch conversions, integrating with cloud applications, or streamlining business workflows, this API provides a reliable and developer-friendly solution. Try GroupDocs.Conversion Cloud SDK today and experience hassle-free ODS to Excel conversion with minimal effort!

We highly recommend going through following links to learn more about: