Best way to store a spreadsheet with dataSource and styles

0 Answers 21 Views
Data Source Spreadsheet
George
Top achievements
Rank 2
Iron
Iron
Iron
George asked on 15 May 2024, 10:09 PM

Hi,

Actually two questions.

(1)If a user imports their excell spreadsheet with formulas, styles and values, is it converted into JSON and viewable by access the sheets property of the Spreadsheet?  Does the spreadsheet control convert the excell properties into the sheets property (in JSON)? Is it converted like this:

Ideally, we would have one sheet with all the styles and formulas (really just references to other sheets with actual values) and the data would be referred to as a formula in the first sheet like this:

The value for cell A3 is in the formula, it is just referring to a cell in Sheet1; Sheet1!A1.

Is there any way to grab the multi sheet spreadsheet (sheets property I guess) as a JSON object and send it to an API? I see most of the examples have the sheet statically defined in the initialization of the of the component, then the data is bound from a separate dataSource.

I already did an experiment with swapping sheets, and this was somewhat successful, but the next step is to actually grab that sheets property from an API and somehow use the fromJSON() function to place the spreadsheet into the control, in addition to saving it off using JSON to an API.

I understand that it is easier to define the sheets statically when initializing the spreadsheet component, but I need a way to dynamically change the styles and save them off to an API.

Thanks,

George

George
Top achievements
Rank 2
Iron
Iron
Iron
commented on 17 May 2024, 02:00 PM

further explaination on this:

  • All of the examples show the sheets formatting being done while the spreadsheet is being created and initialized in the js code while the spreadsheet control is being initialized.

 

  •  I have found no examples of the spreadsheet getting its formatting from a remote source, like an API… so maybe that's not possible….

 

  • Although I am able to swap the objects that define the sheets property, the refresh() function doesn't seem to re-render the control with the change. due to an identifiable bug.

This all being said...

Would be nice to have a tutorial on:

(1) how to dynamically assign a new sheets object to the sheets property in the Kendo Spreadsheets's options

(2) ...then push data into that sheets definition via a dataSource component in jQuery.

Neli
Telerik team
commented on 20 May 2024, 02:51 PM

Hi George,

As far as I understand you need to add a sheet to the Spreadsheet and then set a dataSource to the new Sheet. Is this correct? 

You can add a sheet using the insertSheet method:

https://docs.telerik.com/kendo-ui/api/javascript/ui/spreadsheet/methods/insertsheet

You can bind a sheet to a datasource instance using the setDataSource method:

https://docs.telerik.com/kendo-ui/api/javascript/spreadsheet/sheet/methods/setdatasource

However, The dataSource is designed to operate with flat data. You can review the supported field types in the dataSource.schema.model configuration option.  

https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/schema

 When using the DataSource bound Spreadsheet there are some particular cases that you need to keep in mind. As described in the Specific Behavior section linked below Cell styles, formulas, and formats are not persisted in the data source.

https://docs.telerik.com/kendo-ui/controls/spreadsheet/import-and-export-data/bind-to-data-source#specific-behavior

Please review the provided infromation and let me know in case you have any additional questions on the matter. 

Regards,

Neli

George
Top achievements
Rank 2
Iron
Iron
Iron
commented on 20 May 2024, 03:07 PM

Neli,

Well ultimately I would like to bring in an entire "sheets" property, with styles, formats, formulas first.... then bring in a couple of other sheets with raw data .... the first sheet with the styles, formats, etc.. would reference these other "data bound" sheets, ideally. The user would be able to export the data from the control optionally and put it in a PDF or Excel spreadsheet... but I am getting ahead of myself.  I will see if I can sift through the examples and make it do what I want, this is great, a start... I have a long way to go. Will contact you with more questions as they come up.

Thanks again!

George

Neli
Telerik team
commented on 23 May 2024, 12:18 PM

Hi George,

Take your time to examine and test the provided infromation and methods. Do not hesitate to contact us in case you have additional questions.

Regards,

Neli

No answers yet. Maybe you can help?

Tags
Data Source Spreadsheet
Asked by
George
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or