How to get binary object of the file

Hi 

I'm working in ReactJS/javascript frontend.
Is there any method to get the spreadsheet binary object ?
I need the spreadsheet file object in below format

-------------------
File {upload: {…}, status: "error", previewElement: div.dz-preview.dz-file-preview.dz-error, previewTemplate: div.dz-preview.dz-file-preview.dz-error, _removeLink: a.dz-remove, …}
accepted: false
lastModified: 1599547319227
lastModifiedDate: Tue Sep 08 2020 12:11:59 GMT+0530 (India Standard Time) {}
name: "useForTest.xlsx"
previewElement: div.dz-preview.dz-file-preview.dz-error.dz-complete
previewTemplate: div.dz-preview.dz-file-preview.dz-error.dz-complete
size: 5299
status: "error"
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
upload: {uuid: "ff1b5b83-6a26-4b71-8604-a020bc24d648", progress: 0, total: 5299, bytesSent: 0, filename: "useForTest.xlsx", …}
webkitRelativePath: ""
_removeLink: a.dz-remove
__proto__: File
-----------------------------------------

Thanks,

1 Reply 1 reply marked as answer

SD Saranya Dhayalan Syncfusion Team September 9, 2020 12:07 PM UTC

Hi Arul Lakshmanan, 
 
Thank you for contacting Syncfusion support 
 
We have checked your reported query, you can achieve to access the remote excel file by using the created event. In this event you can get the file object. Please refer the below code snippets. 
 
  onCreated() { 
        this.spreadsheet.cellFormat({ fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle' }, 'A1:F1'); 
        this.spreadsheet.numberFormat('$#,##0.00', 'F2:F31'); 
        fetch("https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx") 
            .then((response) => { 
                response.blob().then((fileBlob) => { 
                    var file = new File([fileBlob], "Sample.xlsx"); 
                    console.log(file); // you can get the file object           
                }) 
            }) 
    } 
 
For your convenience, we have prepared a sample. Please find the below sample link 
 
 
Please check the above sample and get back to us if you need further assistance on this. 
 
Regards, 
Saranya D 


Marked as answer
Loader.
Up arrow icon