Articles in this section
Category / Section

How to import an external URL excel file while initial load the Spreadsheet component?

1 min read

Description

This knowledge base explains to import an excel file initially from an external URL to the JavaScript Spreadsheet component.

You can achieve to access the remote excel file by using the created event. In this event you can fetch the excel file and convert it to a blob. Convert this blob to a file and open this file by using Spreadsheet component open method.

 

[HTML]

 

<div id="spreadsheet"></div>        

 

[TS]

 

//Initialize Spreadsheet component.
        let spreadsheet: Spreadsheet = new Spreadsheet({
            openUrl: 'https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/open',
            saveUrl: 'https://ej2services.syncfusion.com/production/web-services/api/spreadsheet/save',
            created: (): void => {
                fetch("https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx") // fetch the remote url
 
                    .then((response) => {
 
                        response.blob().then((fileBlob) => { // convert the excel file to blob
 
                            let file = new File([fileBlob], "Sample.xlsx"); //convert the blob into file
 
                            spreadsheet.open({ file: file }); // open the file into Spreadsheet
 
                        })
 
                    })
            }
        });
 
        //Render initialized Spreadsheet component.
        spreadsheet.appendTo('#spreadsheet');

 

Demo Sample: https://stackblitz.com/edit/bkampd-d3xeuf?file=index.ts 

 

 Conclusion

I hope you enjoyed learning about how to import an external URL excel file while initial load the spreadsheet component.

You can refer to our JavaScript Spreadsheet feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.  You can also explore our JavaScript Spreadsheet example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied