Programmatically fire the 'Open' command

Hi,

We would like to Programmatically fire the 'Open' command and import the excel file into the spreadsheet. Can you please help with this?

Also, instead of opening a new worksheet, can data be imported into the existing open worksheet from a specific cell range (without overwriting the existing data)?

Thanks

1 Reply 1 reply marked as answer

GK Gayathri KarunaiAnandam Syncfusion Team January 19, 2021 04:35 PM UTC

Hi Sanjay,  
Thank you for contacting Syncfusion support.  
 
QUERY 1: Open and import the excel file into the spreadsheet 
We have checked your reported query and we can access the remote excel file using created event in spreadsheet as demonstrated in the below code snippet, 
[Index.cshtml] 
 
@Html.EJS().Spreadsheet("spreadsheet").Created("created").OpenUrl("https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/open").AllowOpen(true).SaveUrl("https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/save").AllowSave(true).Render() 
 
<script> 
 
    function created() { 
        fetch("https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx") // fetch the remote url 
 
            .then((response) => { 
 
                response.blob().then((fileBlob) => {  
 
                    let file = new File([fileBlob], "Sample.xlsx");  
 
                    this.open({ file: file }); // open the file into Spreadsheet 
 
                }) 
 
            })} 
 
</script> 
 
  
  
QUERY 2: data to be imported into the existing open worksheet from a specific cell range 
We have checked your reported requirement and we would like to let you know that we have option to merge the two excel files in server side only and load the merged excels in spreadsheet. And we can not be able to merge the spreadsheet data with imported excel in UI level. If you have two excels to merge, it can be done at the server side and load in the spreadsheet. 
Could you please check the above details and get back to us, if you need any further assistance on this. 
  
Regards, 
Gayathri K 


Marked as answer
Loader.
Up arrow icon