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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Reading in Excel file to Spreadsheet control

Thread ID:

Created:

Updated:

Platform:

Replies:

123256 Mar 1,2016 08:35 PM UTC Mar 3,2016 02:37 PM UTC ASP.NET MVC 3
loading
Tags: Spreadsheet
Mark
Asked On March 1, 2016 08:35 PM UTC

Hi, Is there a sample for reading in an Excel file to the Spreadsheet control?

I am able to use a collection as the Datasource but would now like to read in a .xlsx file

Mohan Kumar Ramasamy [Syncfusion]
Replied On March 2, 2016 11:12 AM UTC

Hi Morrison,


Thanks for your interest in Syncfusion products.


We suggest you to use “importUrl” property to load the excel file and “ImportMapper” property is used to map the import controller action. Please refer below code snippets.


View.cshtml


@(Html.EJ().Spreadsheet<object>("Spreadsheet")

----------

.ImportSettings(import =>

    {         

import.ImportMapper("Import");

import.ImportUrl("http://staging.syncfusion.com:7777/ejSpreadsheet/Spreadsheet.xlsx");

    })

)




Controller.cs



      [AcceptVerbs(HttpVerbs.Post)]

        public ActionResult Import(ImportRequest importRequest)

        {

            return importRequest.SpreadsheetActions();

        }



Note: To open local files we can use “File -> Open” option in ribbon.


For your convenience, we have created a simple sample to demonstrate this and same can be downloaded from below link.


Sample Link: http://www.syncfusion.com/downloads/support/forum/123256/ze/SyncfusionMvcApplication1-1474419519


Please let us know if you need any further assistance.


Regards,

Mohankumar R


Mark
Replied On March 3, 2016 04:48 AM UTC

Thanks - that's great.

I need to set the file on the server side. Is there a way I can do this from the Controller?

Can I load the file from a stream?

Mohan Kumar Ramasamy [Syncfusion]
Replied On March 3, 2016 02:37 PM UTC

Hi Morrison,


We considered this “Importing excel file url from the control action on initial load” as an improvement task and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.


https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents


Regards,

Mohankumar R


CONFIRMATION

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.

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

;