Convert SXC to CSV Using GroupDocs.Conversion for .NET
Introduction
Struggling with converting legacy Macintosh spreadsheet files (.sxc) into more accessible and versatile CSV formats? This common challenge can be seamlessly resolved using the powerful GroupDocs.Conversion for .NET library. In this tutorial, we’ll guide you through transforming your SXC files to CSV format efficiently.
- What You’ll Learn:
- How to load and convert SXC files using GroupDocs.Conversion
- Setting conversion options to export as CSV
- Saving the converted file with ease
Let’s dive into what you need before we get started.
Prerequisites
Before jumping into code, ensure your environment is ready:
Required Libraries:
- GroupDocs.Conversion for .NET (Version 25.3.0)
Environment Setup Requirements:
- Visual Studio or any preferred IDE that supports C#
Knowledge Prerequisites:
- Basic understanding of file handling in C#
Setting Up GroupDocs.Conversion for .NET
First, let’s get the necessary library installed:
NuGet Package Manager Console
Install-Package GroupDocs.Conversion -Version 25.3.0
.NET CLI
dotnet add package GroupDocs.Conversion --version 25.3.0
License Acquisition
You can start with a free trial to explore the features of GroupDocs.Conversion:
- Free Trial: Use this link to download.
- Temporary License: Obtain one here.
- Purchase: For full access, visit GroupDocs purchase page.
Basic Initialization and Setup
To initialize GroupDocs.Conversion in your C# project:
using GroupDocs.Conversion;
// Your code to load files will go here
Implementation Guide
Now let’s break down the implementation into clear steps.
Load Source SXC File
Overview
Loading an SXC file is the first step in our conversion process. This involves initializing a Converter
object with the source file path.
Step-by-Step Guide
Initialize Converter Object
string sampleSxcPath = "YOUR_DOCUMENT_DIRECTORY/sample.sxc";
// Load the source SXC file
var converter = new Converter(sampleSxcPath);
- Parameters:
sampleSxcPath
: The full path to your SXC file.
This step ensures that the conversion process can access and read your input file correctly.
Set Conversion Options to CSV
Overview
Next, we define how our SXC file will be converted into a CSV format. This involves setting up SpreadsheetConvertOptions
.
Step-by-Step Guide
Configure Conversion Options
using GroupDocs.Conversion.Options.Convert;
// Create an instance of SpreadsheetConvertOptions with desired settings
var convertOptions = new SpreadsheetConvertOptions
{
Format = FileType.Csv // Specify the target format as CSV
};
- Key Configuration:
Format
: Specifies that the output should be in CSV format.
This configuration tells GroupDocs.Conversion exactly how to process and export your file.
Perform Conversion and Save Output File
Overview
Finally, we execute the conversion and save the result. This step is crucial for obtaining the desired CSV output.
Step-by-Step Guide
Execute Conversion and Save
string outputFile = Path.Combine("YOUR_OUTPUT_DIRECTORY\