Skip to content

Instantly share code, notes, and snippets.

@groupdocs-cloud-gists
Last active April 17, 2024 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save groupdocs-cloud-gists/fe757d91b24bdf4fb2ad7077054f2ef4 to your computer and use it in GitHub Desktop.
Save groupdocs-cloud-gists/fe757d91b24bdf4fb2ad7077054f2ef4 to your computer and use it in GitHub Desktop.
CSV to Excel online

Convert CSV to Excel with C# .NET


Let's harness the power of C# .NET to gain access to a versatile toolkit as it streamlines the conversion process, enabling you to leverage Excel's robust features for data analysis, visualization, and reporting. Let's explore the details of converting Excel to CSV using GroupDocs.Conversion Cloud SDK for .NET API.



For more details, please visit Effortlessly Convert Excel to PDF with C# .NET.

csv to excel

Important Links

Product Page | Docs | Live Demo | API Reference | Code Samples | Source Code | New Releases | Blog | Free Support | Free Trial

How to convert CSV to XLS online
// More examples over https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet
// Obtain your API credentials
string clientId = "4bdefca3-f08c-4088-9ca0-55c38f4b7f22";
string clientSecret1 = "a43c8b4365246a062688a259abe5b469";
// Create an instance of the Configuration class and initialize it with the Client ID & Client Secret.
var configurations = new GroupDocs.Conversion.Cloud.Sdk.Client.Configuration(clientId, clientSecret1);
// Define the value of ApiBaseUrl to set the base url of the CSV to Excel conversion API.
configuration.ApiBaseUrl = "https://api.groupdocs.cloud";
// Initialize an instance of the ConvertApi class with the object of the Configuration class.
var apiInstance = new GroupDocs.Conversion.Cloud.Sdk.Api.ConvertApi(configurations);
// load the input Excel workbook from local drive
using (var stream = System.IO.File.OpenRead("input.xls"))
{
// create an instance of FileApi
var fileUpload = new FileApi(configurations);
// upload the input Excel workbook to cloud storage
fileUpload.UploadFile(new UploadFileRequest("input.csv", stream));
// create ConvertSettings where we define the input CSV file and the name for resultant XLS workbook
var settings = new ConvertSettings
{
StorageName = "internal",
FilePath = "input.csv",
Format = "xls",
OutputPath = "resultant.xls"
};
// Invoke the ConvertDocument method for CSV to XLS conversion online.
var response = apiInstance.ConvertDocument(new GroupDocs.Conversion.Cloud.Sdk.Model.Requests.ConvertDocumentRequest(settings));
if (response != null && response.Equals("OK"))
{
// print success message
Console.WriteLine("The conversion of CSV to Excel completed successfully !");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment