Telerik skin

Spreadsheet - Import/Export an Excel File

Note: The Import functionality uses RadAsyncUpload for file selection and management of the uploaded file. Since the IE 9 uses Silverlight module, the import functionality in the demo will not be available under this version of the Internet Explorer.

  • Home
  • Insert
  • Undo
  • Redo
  • Paste
  • Cut
  • Copy
  • Bold
  • Italic
  • Underline
  • Arial
  • Pick Color(Current Color is blank)
  • Pick Color(Current Color is blank)
  • All borders
    • All borders
    • Inside borders
    • Inside horizontal borders
    • Inside vertical borders
    • Outside borders
    • Left border
    • Top border
    • Right border
    • Bottom border
    • No border
  • Pick Color(Current Color is blank)
  • Horizontal alignment
    • Align Left
    • Align Center
    • Align Right
    • Justify
  • Vertical alignment
    • Align Top
    • Align Middle
    • Align Bottom
  • Wrap text
  • Merge Cells
    • Merge Cells
    • Merge Horizontally
    • Merge Vertically
    • Unmerge
  • Add column left
    • Add column left
    • Add column right
    • Add row above
    • Add row below
  • Delete cells
    • Delete column
    • Delete row
  • Cut
  • Copy
  • Paste
  • Hide
  • Unhide
  • Delete
  • Hide
  • Unhide
  • Delete
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

The demo shows two important functionalities that could be easily achieved with the RadSpreadsheet Import from an Excel File and Export to an Excel File. This can be achieved, using the Client API of the control. For Export you can invoke the saveAsExcel() function on the RadSpreadsheet object and the file will directly prompt you to download in your browser.

As for the Import - you can use the fromFile() passing the actual Excel file to the function. In the demo, the RadAsyncUpload control is used for selection of a file. You can observe how th OnClientFileSelected client-side event of the RadAsyncUpload is used, in order to get a reference to the selected file and supply the RadSpreadsheet with it:

            var file = args.get_fileInputField().files[0];          // get the selected file from the RadAsyncUpload
            var spreadsheet = $find("<%= RadSpreadsheet1.ClientID %>");
            spreadsheet.fromFile(file);      //supply the RadSpreadsheet control with the Excel file.
            $(args.get_row()).remove();         //remove the row, visualizing the selection in the RadAsyncUpload


  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb"  Inherits="Spreadsheet.Examples.Import_Export.DefaultVB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
     <qsf:MessageBox ID="MessageBox" Type="Info" Icon="Warning" runat="server" Visible="true">
            <b>Note</b>: The <b>Import</b> functionality uses RadAsyncUpload for file selection and management of the uploaded file. Since the <b>IE 9</b> uses Silverlight module, 
            the import functionality in the demo will not be available under this version of the Internet Explorer.
    <div class="demo-container">
        <div class="buttons">
            <telerik:RadButton runat="server" ID="btnExport" AutoPostBack="false"
                OnClientClicked="exportFile" Text="Export to Excel File">
            <telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" HideFileInput="true" AllowedFileExtensions=".xlsx, .xls"
                OnClientFileSelected="importFile" OnClientFileDropped="importFile" Localization-Select="Import From Excel File">
        <telerik:RadSpreadsheet runat="server" ID="RadSpreadsheet1">
                <telerik:SpreadsheetToolbarTab Text="Home">
                        <telerik:SpreadsheetTool Name="Undo" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="Redo" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="Paste" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="Cut" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="Copy" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="Bold" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="Italic" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="Underline" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="FontFamily" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="FontSize" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="BackgroundColor" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="TextColor" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="BorderType" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="BorderColor" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="HorizontalAlignment" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="VerticalAlignment" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="TextWrap" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="MergeCells" ShowLabel="false" />
                <telerik:SpreadsheetToolbarTab Text="Insert">
                        <telerik:SpreadsheetTool Name="InsertCells" ShowLabel="false" />
                        <telerik:SpreadsheetTool Name="DeleteCells" ShowLabel="false" />


    <script type="text/javascript">
        function exportFile() {
            var spreadsheet = $find("<%= RadSpreadsheet1.ClientID %>");

        function importFile(sender, args) {
            var file = null;
            if (args.get_file) {
                file = args.get_file();
            else if (!( && Telerik.Web.Browser.version == "9")) {
                file = args.get_fileInputField().files[0];
            if (file) {
                var spreadsheet = $find("<%= RadSpreadsheet1.ClientID %>");


Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?