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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get data change when edit on Spreadsheet and save to file?

Thread ID:





149335 Nov 22,2019 02:58 AM UTC Dec 2,2019 01:27 PM UTC ASP.NET Core - EJ 2 6
Tags: Spreadsheet
Nguyen Gia Huy
Asked On November 22, 2019 02:58 AM UTC

I opened file exel from URL and edited. I want to save data change to file. Can you support me to slove this.

Madhan Venkateshan [Syncfusion]
Replied On November 22, 2019 11:27 AM UTC

Hi Nguyen, 
Thanks for contacting Syncfusion support. 
Query #1: Opening a excel file from the server 
We would like to suggest that you can open an excel file from the server using open method of spreadsheet control after http request. Please refer the code snippets below. 
<button class="e-btn" onclick="saveToServer()">Save Back to Server</button> 
<ejs-spreadsheet id="spreadsheet" openUrl="Home/Open" saveUrl="Home/Save" created="onCreated"></ejs-spreadsheet> 
    function onCreated() { 
        var spreadsheetObj = ej.base.getComponent(document.getElementById('spreadsheet'), 'spreadsheet'); 
        var request = new XMLHttpRequest(); 
        request.responseType = "blob"; 
        request.onload = () => { 
            var file = new File([request.response], "Sample1.xlsx"); 
            spreadsheetObj.open({ file: file }); 
        request.open("GET", "/Files/" + "Sample1.xlsx"); 
    function saveToServer() { 
        var spreadsheetObj = ej.base.getComponent(document.getElementById('spreadsheet'), 'spreadsheet'); 
Query #2: Save data back to the excel file 
You can able to achieve this by using save method of spreadsheet control to call the server controller method, In the controller method you can able to save back to the same excel file by using SaveAs method of XlsIO. Please refer the code snippets below. 
public string Save(SaveSettings saveSettings) 
            ExcelEngine excelEngine = new ExcelEngine(); 
            IApplication application = excelEngine.Excel; 
                // Convert Spreadsheet data as Stream 
                Stream fileStream = Workbook.Save<Stream>(saveSettings); 
                IWorkbook workbook = application.Workbooks.Open(fileStream); 
                var filePath = Startup._env.ContentRootPath.ToString() +  "/Files/Sample1.xlsx"; 
                FileStream outputStream = new FileStream(filePath, FileMode.Create); 
                return "Spreadsheet saved in server"; 
            catch (Exception ex) 
                return "Failure"; 
We have prepared the sample for your requirement, please refer the sample link below 
Madhan V 

Nguyen Gia Huy
Replied On November 25, 2019 03:53 AM UTC

Thank you so much for your reply.
I ran project example in your link, when i clicked on button "Save Back to Server", the button did not working. Press F12, in Console tab, i got error with message :"Uncaught Uncaught SyntaxError: Unexpected token 'function'" in file constants.js:93.
Please, support me to slove this plobrem. Thank you.

Madhan Venkateshan [Syncfusion]
Replied On November 25, 2019 12:20 PM UTC

Hi Nguyen, 
Sorry for the inconvenience caused. 
The reported issue is a known issue in our side. We have fixed the issue and it will be available in upcoming patch release on November 27 and appreciate your patience until then. We would suggest you to refer the below ej2 script of previous release version 17.3.16 until upcoming patch release as a workaround solution to resolve the issue at your end. 
<script src="https://cdn.syncfusion.com/ej2/17.3.16/dist/ej2.min.js"></script> 
Madhan V 

Nguyen Gia Huy
Replied On November 26, 2019 01:46 AM UTC

Thank you  very much. I soved this problem. 

Madhan Venkateshan [Syncfusion]
Replied On November 26, 2019 07:24 AM UTC

Hi Nguyen, 
Thank you for your update, We will update you once the patch release has been rolled out. 
Madhan V 

Madhan Venkateshan [Syncfusion]
Replied On December 2, 2019 01:27 PM UTC

Hi Nguyen, 
Thank you for your patience. 
We have corrected the reported issue and included it in the patch release ( version. So we would suggest you to use the updated JS file to resolve the issue in your end. Please find the link below. 
Script Link:  
Could you please check the above links and get back to us, if you need any further assistance on this. 
Madhan V 


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

Live Chat Icon For mobile
Live Chat Icon