excel to powerpoint

Convert Excel (XLS, XSLX) to PowerPoint using C# .NET

Excel and PowerPoint are two of the most commonly used software tools in today’s business world. Excel is used for data analysis and management, while PowerPoint is used for creating presentations. Sometimes, you may need to convert Excel worksheets to PowerPoint presentations, either to present your data in a more visually appealing way or to provide a summary of your analysis. This can be a time-consuming task if done manually, especially if you have to update the data frequently. Luckily, there is a solution that can automate this process and save you a lot of time.

In this blog post, we will show you how to use C# REST API to automate the process of converting Excel worksheets to PowerPoint presentations. We will cover everything you need to know, from setting up the environment to writing the code. So, let’s get started!

Excel to PowerPoint Conversion API

Converting Excel worksheets to PowerPoint presentations using Aspose.Cells Cloud SDK for .NET offers several benefits. First, it saves time by automating the conversion process, allowing you to focus on other tasks. Second, it reduces the likelihood of errors that can occur when manually copying and pasting data from Excel to PowerPoint. Additionally, it’s a user-friendly tool and requires a little prior coding experience. With its simple interface and straightforward instructions, you can quickly convert your Excel worksheets to PowerPoint presentations without any hassle.

To get started, we need to add its reference in our application through NuGet package manager. So search “Aspose.Cells-Cloud” and hit the Add Package button. Secondly, in case you do not have an account over Cloud Dashboard, please create a free account using a valid email address and obtain your personalized client credentials.

Insert Excel into PowerPoint using C#

Please use the code snippet given below to embed Excel to PowerPoint using C#.

Let’s understand the above code snippet:

CellsApi instance = new CellsApi(clientID, clientSecret);

Create an object of CellsApi while passing client credentials as arguments.

var file = System.IO.File.OpenRead(name)

Read the input Excel workbook using OpenRead(…) method of the System.IO.File class.

CellsWorkbookPutConvertWorkbook(file, format: format, outPath: resultantFile);  

Call the above method to convert Excel to PowerPoint format.

using (var fileStream = new FileStream("myResultant.docx", System.IO.FileMode.OpenOrCreate, FileAccess.Write))
{
    response.CopyTo(fileStream);
}

Now, in order to save the resultant PowerPoint (PPTX) to local drive, please use above code lines. Any exceptions that may occur during Excel to PowerPoint conversion will be handled in Try-Catch block.

excel to powerpoint

Excel to PowerPoint conversion preview.

The sample Excel worksheet used in the above example can be downloaded from myDocument.xlsx.

Excel to PPT using cURL Commands

One of the main benefits of using cURL commands to call a REST API is that it provides a simple and flexible way to interact with web-based APIs from the command line. Additionally, cURL commands and REST API provide a user-friendly interface that requires no prior coding experience. Therefore, with straightforward instructions and easy-to-follow commands, you can quickly and efficiently embed your Excel worksheets into PowerPoint presentations.

First, we need to generate a JWT access token based on client credentials:

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bb959721-5780-4be6-be35-ff5c3a6aa4a2&client_secret=4d84d5f6584160cbd91dba1fe145db14" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now we need to execute the following command to embed an Excel workbook to PowerPoint presentation. After successful conversion, the resultant file is stored on local drive (as per path specified in -o parameter).

curl -v -X GET "https://api.aspose.cloud/v3.0/cells/myDocument(1).xlsx?format=PPTX&isAutoFit=true&onlySaveTable=false&checkExcelRestriction=true" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" \
-o "Embed.pptx"

Another option is to convert Excel to PowerPoint and save the output in cloud storage.

curl -v -X GET "https://api.aspose.cloud/v3.0/cells/myDocument(1).xlsx?format=PPTX&isAutoFit=true&onlySaveTable=false&outPath=embedded.pptx&checkExcelRestriction=true" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>"

Concluding Remarks

In conclusion, Aspose.Cells Cloud SDK for .NET and cURL commands provide an efficient and user-friendly way to convert Excel worksheets to PowerPoint presentations. By combining the power of cloud-based technology with the flexibility of cURL commands, you can automate your conversion and embedding process, saving time and improving accuracy. With its straightforward instructions and easy-to-follow commands, streamline your workflow and enhance your productivity. We hope this blog post has provided you with valuable insights and instructions for using Aspose.Cells Cloud SDK for .NET to improve your Excel to PowerPoint conversion process.

Nonetheless, we highly recommend exploring the easy-to-follow comprehensive documentation explaining the details about other exciting features of the API. In case you encounter any issues while using the API, please contact us via customer support forum.

Please visit the following links to learn more about: