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

Loading excel file sitting on server

Thread ID:

Created:

Updated:

Platform:

Replies:

149604 Dec 2,2019 11:59 PM UTC Feb 2,2021 11:18 AM UTC Angular - EJ 2 8
loading
Tags: Spreadsheet
Umair Ahmed
Asked On December 2, 2019 11:59 PM UTC

Hi,

Please provide sample / documentation to load an excel file sitting on server.

Thanks

Madhan Venkateshan [Syncfusion]
Replied On December 3, 2019 05:48 AM UTC

Hi Umair, 
 
Good day to you. 
 
We would like to suggest that you can open an excel file from the server using open method of spreadsheet control after http request. We have prepared a sample based on your requirement, please refer the below sample link and code snippet. 
 
 
App.component.ts 
loadExcel(args: Event) { 
    let request: XMLHttpRequest = new XMLHttpRequest(); 
    request.responseType = "blob"; 
    request.onload = () => { 
      let file: File = new File([request.response], (args.target as HTMLSelectElement).value + ".xlsx"); 
      this.spreadsheetObj.open({ file: file as any }); 
    } 
    request.open("GET", "http://localhost:53142/Files/" + (args.target as HTMLSelectElement).value + ".xlsx"); 
    request.send(); 
  } 
 
 
Regards, 
Madhan V 


Umair Ahmed
Replied On December 4, 2019 09:44 PM UTC

Thanks Madhan, that worked.

Madhan Venkateshan [Syncfusion]
Replied On December 5, 2019 06:06 AM UTC

Hi Umair, 
 
Thank you for your update, Please feel free to contact us if you need any further assistance on this. 
 
Regards, 
Madhan V 


Umair Ahmed
Replied On December 24, 2019 12:40 AM UTC

Hi,

Can you please let me know what event is fired when its done loading the excel file, I found "loadComple" and "openComplete" but none of these seems to be firing, please advise.

Thanks.

Arunkumar Devendiran [Syncfusion]
Replied On January 3, 2020 02:45 AM UTC

Hi Umair, 
 
Sorry for the inconvenience caused. 
 
We can reproduce the reported issue at our end and this is already known issue in our end. We will include the fix for this issue in our next patch release. We suggest you use our Volume 4 main release version (17.4.39) and this issue is not replicated in this version (17.4.39). We have created the sample for your reported query (17.4.39) in that we have using openComplete event. This event triggered on when data is loaded on spreadsheet, in this way you can achieve your requirement. Please refer the below sample and our documentation link. 
 
Sample Link: 
 
Api Link: 
 
Could you please check the above sample and let us know whether this is fulfilling your requirement, if not please share us more information regarding this. So, that we can analyze based on that and provide you a better solution. The information provided would be great help for us to proceed further. 
 
Regards, 
Arunkumar D 


Saranya Dhayalan [Syncfusion]
Replied On January 8, 2020 10:46 AM UTC

Hi Umair, 
  
Good day to you. 
  
We are glad to announce that our weekly patch release (17.4.41) is rolled out. We would like to inform that we have included the openComplete event in our latest version (17.4.41). We have created the sample for your reported query in that version (17.4.41). Please refer the below sample link. 
  
Sample link: 
  
Please get back to us if you need further assistance. 
  
Regards, 
Saranya D 


Arno
Replied On February 1, 2021 07:35 AM UTC

I get error of undefined.

loadExcel(argsEvent) {
    let requestXMLHttpRequest = new XMLHttpRequest();
    request.responseType = "blob";
    request.onload = () => {
      let fileFile = new File([request.response], (args.target as HTMLSelectElement).value + ".xlsx");      
      this.spreadsheetObj.open({ file: file as any });
    }
    request.open("GET""http://localhost:53142/Files/" + (args.target as HTMLSelectElement).value + ".xlsx");
    request.send();
  }

"this.spreadsheetObj.open({ file: file as any });" Open of undefined.

Any ideas why this would be?


Sangeetha Priya Murugan [Syncfusion]
Replied On February 2, 2021 11:18 AM UTC

Hi Arno, 
 
Thank you for your update. 
 
We have checked your reported issue and we would like to let you know that the spreadsheet instance not getting properly based on your provided code. So, we suggest you to get the instance properly while calling the open method. For your convenience, we have prepared the sample based on your requirement, please find link below. 
 
  @ViewChild("default") 
  public spreadsheetObj: SpreadsheetComponent; 
  
created() { 
    fetch( 
      "https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx" 
    ).then(response => { 
      response.blob().then(fileBlob => { 
        var file = new File([fileBlob], "Sample.xlsx"); 
        this.spreadsheetObj.open({ file: file }); // To open the excel file 
      }); 
    }); 
  } 
 
 
 
Could you please check the above links and get back to us, if you need any further assistance on this. 
 
Regards, 
Sangeetha M 


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.

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