We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Save to Server

Thread ID:





127270 Nov 7,2016 08:10 PM UTC Nov 8,2016 12:39 PM UTC JavaScript 1
Tags: ejSpreadSheet
Will Smith
Asked On November 7, 2016 08:10 PM UTC

Is there a way to save the data in a spreadsheet control to the server? I don't mind downloading it to client, but I would like to keep changes on the server side too.

Spreadsheet.Save(sheetModel, sheetData, filename, ExportFormat.XLSX, ExcelVersion.Excel2013);

Silambarasan I [Syncfusion]
Replied On November 8, 2016 12:39 PM UTC

Hi Will, 
Thank you for using Syncfusion products. 
Your requirement “To save the data in a Spreadsheet control to the server” can be achieved by using ‘Save()’ method in Spreadsheet.  Please refer the following code example. 
public void ExportToExcel(string sheetModel, string sheetData, string password) 
    SaveFileToDB(sheetModel, sheetData); 
public void SaveFileToDB(string sheetModel, string sheetData) 
    string dbConnectionStr = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\spreadsheetDB.mdf;Integrated Security=True"; 
    SqlConnection sqlCon = new SqlConnection(dbConnectionStr); 
    //Get Spreadsheet data as Stream 
    Stream streamData = Spreadsheet.Save(sheetModel, sheetData, ExportFormat.XLSX, ExcelVersion.Excel2013); 
    Byte[] dataBytes = ((MemoryStream)streamData).ToArray(); 
    SqlCommand sqlComm = new SqlCommand("INSERT INTO [dbo].[Table]([FileName], [FileData]) VALUES (@FileName, @FileData)", sqlCon); 
    sqlComm.Parameters.AddWithValue("@FileName", "Sample"); 
    sqlComm.Parameters.AddWithValue("@FileData", dataBytes); 
        excelUrl: "/Home/ExportToExcel", 
For your convenience, we have prepared a sample to demonstrate this and the same can be downloaded from the below link, 
Silambarasan I 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon