BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Hi,
I am having trouble saving a spreadsheet if it is too large in size. I want to get the base64 of my file, via the save() method, but this returns 405 Method not Allowed if the size is too large (e.g. 600x5 rows/cols). It works for smaller files.
How can I solve this problem?
Thank you,
Nick.
Hi Nick Fox,
We have validated your query based on the details you provided. To investigate the reported issue, we created a dummy Excel file (shared in the attachment) with 600 rows and 6 columns. We then imported the file and saved it as a Base64 file using the save method triggered by a button click. In the beforeSave event, we set needBlobData to true and isFullPost to false. This allowed us to retrieve the spreadsheet data as a blob in the saveComplete event. We then converted the blob data to a Base64 string using FileReader. However, we were unable to replicate your reported `405 method not allowed` issue on our end.
Additionally, we shared a video demonstration showing that the issue is not being reproduced on our end and the sample link we have used.
Video sample - refer to the below attachment.
Sample link - N9wqzmou (forked) - StackBlitz
Note: We would like to inform you that in our demo samples, we use hosted Syncfusion-service URLs for the Open and Save actions. These URLs are intended for demo purposes only. Therefore, we recommend avoiding the use of the online-service for your development purposes. Instead, we recommend creating and using your own local-service for the Open and Save actions.
We kindly inform you that we have implemented the Open and Save (server-side) functionality in ASP.NET Core and ASP.NET MVC using the Syncfusion XLSIO library. The XLSIO library is used on our server to handle these actions. When you open a file, the XLSIO library reads and converts it to a spreadsheet-compatible workbook in JSON format. Similarly, when you save the spreadsheet, we process the workbook JSON into an Excel model using the XLSIO library. Rest assured, your data is not stored on our server during these actions, ensuring it remains safe and secure.
For your convenience, we have attached the local service sample below.
After taking the local service from the attachment, please follow the below steps to launch the local service on your end.
For your convenience, we have attached the open and save code snippets in local service, local service, and sample below.
Code snippet:
[HttpPost] [Route("Open")] public IActionResult Open([FromForm]IFormCollection openRequest) { OpenRequest open = new OpenRequest(); open.File = openRequest.Files[0]; return Content(Workbook.Open(open)); } //Save method [HttpPost] [Route("Save")] public IActionResult Save([FromForm]SaveSettings saveSettings) { return Workbook.Save(saveSettings); } |
Service sample: Please refer to the attachment.
After, launching the local service, you need to update the open and save URL in
the Client-Side sample like in the below code snippet,
saveUrl= 'https://localhost:{port number}/api/spreadsheet/save' Example: openUrl= 'https://localhost:44354/api/spreadsheet/open' saveUrl= 'https://localhost:44354/api/spreadsheet/save' |
Note: Launch the service before running the client-side sample.
For local service you need ASP.NET Core project as a backend for Open/Save
functionality in your client application.
Local service available in below GitHub location also:
https://github.com/SyncfusionExamples/EJ2-Spreadsheet-WebServices/
Create ASP.NET Core project and generate the license based on the below KB
link.
https://www.syncfusion.com/kb/8976/how-to-generate-license-key-for-essential-studio-products
And include the licensed key in your project startup file as like in the below
documentation link.
https://help.syncfusion.com/common/essential-studio/licensing/license-key
You can also host and run our Spreadsheet-oriented service as a Docker image. Utilizing a Docker image necessitates only a simple and basic Docker environment with minimal commands to effortlessly host and run our service.
You can utilize the below service and use it for Spreadsheet Open and Save services, by pulling the spreadsheet docker image and following the steps from the URL mentioned below.
Spreadsheet docker image: https://hub.docker.com/r/syncfusion/spreadsheet-server
For more information regarding the docker deployment, please refer the below
documentation,
https://ej2.syncfusion.com/angular/documentation/spreadsheet/docker-deployment
If the issue persists after using local services, please share the following details with us:
Please share the above requested information from your end. Based on that, we will validate and update you with further details.