How to import an excel spreadsheet as text w/o format -- is there a way?

1 Answer 65 Views
Spreadsheet
George
Top achievements
Rank 3
Bronze
Bronze
Iron
George asked on 13 Sep 2024, 07:37 PM

Hi,

Am having difficulty importing data, into a kendo UI spreadsheet, specifically date data as text. Is there a way to bypass the whole OLE date format from the Excell file so I just get a string? and Not that float value in OLE date format? In fact, importing every cell as just a string and not a formatted value (with a format property and a value property)...and just a value would be awesome. 

Thanks again for your help and patience!

George

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 18 Sep 2024, 09:47 AM

Hello, George,

A possible approach you can try is to handle the excelImport event to process the e.sheet argument which is a Kendo Sheet object, although it would probably require a lot of custom logic alongside the Sheet API.

Another approach would be to process the data on the server and use the fromJSON method to load the data in the Spreadsheet, as demonstrated in the Server Import/ Export demo.

Let me know if that would be useful.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

George
Top achievements
Rank 3
Bronze
Bronze
Iron
commented on 18 Sep 2024, 02:43 PM

Martin,

Hi. The other problem is the user is loading (or importing via the import button) this into the spreadsheet control from an Excel spreadsheet. So, the customer may have fiddled with the date format, and even if they don't it somehow recognizes it's a date; it seems like I have no control over customer input.

Which means it may or may not give the date in the OLE format from the beginning. For what I am doing it might have the date as a string, great but it might have the date in OLE format with a format property, and that format property varies! I can change it (If I know ahead of time that the column is a date :) ) by using kendo.toString(date, format), but again... that means I know ahead of time.... as of now I am begging the customer to identify the date column by adding a substring of DATE to the column name.

Hope that makes sense and thanks for the ideas,

George

Nikolay
Telerik team
commented on 23 Sep 2024, 09:54 AM

Hi George,

It's difficult to set the format to a column without knowing which column is the date one. As Martin mentioned you can modify the e.sheet in the the excelImport event handler. You can try traveling the rows and identifying if the input contains a date or not then happy the kendo.toString(date, format).

Regards,

Nikolay

Tags
Spreadsheet
Asked by
George
Top achievements
Rank 3
Bronze
Bronze
Iron
Answers by
Martin
Telerik team
Share this question
or