igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

Load data using json data

Open dphizler opened this issue 3 years ago • 1 comments

Description

Currently we can only load data using an Excel sheet. I want to be able to load data using json into the spreadsheet component.

  • igniteui-angular version: 14
  • browser: Chrome

Steps to reproduce

Json data that I would want to import:

export let dataSourceCustom1: Object[] = [
  {
    "A":"",
    "B":"",
    "C":"100",
    "D":"10",
    "E":"=C1+D1",
    "F":"",
    "G":"",
    "H":"",
    "I":"",
    "J":"",
    "K":"",
    "L":"",
    "M":"",
    "N":""
  },
  {
    "A":"",
    "B":"",
    "C":"",
    "D":"",
    "E":"",
    "F":"",
    "G":"",
    "H":"",
    "I":"",
    "J":"",
    "K":"",
    "L":"",
    "M":"",
    "N":""
  }
];

Result

What is the actual result after following the steps to reproduce? No way to import/export json data

Expected result

What is the expected result after following the steps to reproduce? It would load the data into the spreadsheet app and the user could input data and eventually use a button to click to save the json data to the database.

Attachments

Attach a sample if available, and screenshots, if applicable.

dphizler avatar Aug 03 '22 19:08 dphizler

The spreadsheet control is designed to view and edit an excel workbook so really this is more about a feature to support loading/saving a Workbook to/from json. However in your example you are just storing data. The excel object model is much more complex including one or more worksheets, rows/columns that can be sized, merged cells, row/column/cell formatting, cell/array/datatable formulas, tables (with sorting and filtering), shapes/charts, data validations, comments, etc. Also the data within a worksheet need not look tabular - it is cell based and so a user could assign a value to A1 and to XFD1048576.

If you need such functionality it would be best to implement this in your application code by evaluating/enumerating the excel object model and saving what parts you want to json and then similarly on a load of said json using the excel object model to construct a workbook/worksheets and populate the rows/cells. I’ve created a basic example you can try to use as a starting point for such an operation and then you change/extend it as you need. For example you might decide that you want to keep the number formatting and so not just save cell values but a cell object with the value and formatting (and any other state you want to keep).

igandrews avatar Aug 04 '22 16:08 igandrews

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Oct 04 '22 00:10 github-actions[bot]