# Convert Workbook Formats using Data from Storage

## Content

This section demonstrates how to call the Web API service through a client application to convert the excel file available in storage (remote storage or storage at the same server) to a different file format.
[Step 1: Call the Service](/componentone/docs/webapi/online-webapi/Services/ExcelServices/GenerateExcelService/GETConvertExcelFormats#step-1-call-the-service)
[Step 2: Run the Client Project](/componentone/docs/webapi/online-webapi/Services/ExcelServices/GenerateExcelService/GETConvertExcelFormats#step-2-run-the-client-project)
The following example makes a call to the Web API [service](/componentone/docs/webapi/online-webapi/overview/WorkingwithC1WebAPI/ConfiguringWebAPI) through HTML as well as WinForms client applications. These clients send a GET request to the service, which returns a response stream. This response stream is then saved in the desired excel file format.
In the following example, the service URL takes name and location of excel workbook (present in [storage](/componentone/docs/webapi/online-webapi/overview/WorkingwithC1WebAPI/ConfiguringWebAPI/Configuring.NETCollections)) in **WorkBookFileName** parameter and the desired file format, json, in **Type** parameter. The specified excel workbook, results.xlsx, resides in root folder of the hosted service.
![](https://cdn.mescius.io/document-site-files/images/66c72527-2495-47b0-9257-2ee31dae74e5/images/getconvertexcel.png)

### Step 1: Call the Service

Complete the following steps to call the Web API service.
**csharp**

```csharp
public void ConvertExcel() {
  var apiURL = string.IsNullOrEmpty(C1TextBox1.Text) ?   "https://developer.mescius.com/componentone/demos/aspnet/c1WebAPI/latest/api/excel?  FileName=excel&type=json&workbookfilename=root%2Grouping.xlsx" : C1TextBox1.Text;
  WebRequest request = WebRequest.Create(apiURL);
  WebResponse response = request.GetResponse();
  var fileStream = File.Create("D:\\ExcelConvert.json");
  response.GetResponseStream().CopyTo(fileStream);
}
```

**HTML**
1\. Create an HTML application\, as discussed in [Configure Client for REST API service](/componentone/docs/webapi/online-webapi/overview/WorkingwithC1WebAPI/configuring-the-client-application/ClientAppRESTApiServices).

2. Add the following markups in the \<form> tags, within \<body> tags, of your HTML page.

    ```html
    <form action="https://developer.mescius.com/componentone/demos/aspnet/c1WebAPI/latest/api/excel" method="GET">
            <label for="fileName">File Name:</label>
            <input type="text" id="fileName" name="fileName" value="ExcelConvert" />
            <br />
            <label for="fileFormat">File Format:</label>
            <input type="text" id="fileFormat" name="type" value="json" />
            <br />
            <label for="WorkBookFileName">WorkBook File Name:</label>
            <input type="text" id="WorkBookFileName" name="WorkBookFileName" value="root/Grouping.xlsx" />
            <input type="submit" value="Convert Excel Format"/>
    </form>
    ```

    Note that, for GET request we set **method** attribute of \<form> tag to GET, and set its **action** attribute to service request URL. Also, we create input controls on the HTML page, which take various parameters to generate the excel in the desired format from the excel workbook, present in the storage.

### Step 2: Run the Client Project

**WinForms Application**

* Click **Build \| Build Solution** to build the project.
* Press **F5** to run the project.
* Provide the service URL, along with the query string containing appropriate parameters, in the textbox corresponding to Request URL field.
* Click the **Convert Excel Format** button. The generated excel data stream will get downloaded at the location specified within the ConvertExcel() method.

**HTML Application**

* Save your HTML file and open it in a browser.
* Set the appropriate parameters for the desired excel file format, and click **Convert** **Excel Format** button.

>type=note
> Explore detailed demo samples of REST API service to convert workbook formats at:
>
> * [Convert Excel Format Live Demo](https://demos.componentone.com/ASPNET/WebApiExplorer/)