Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Json Data Or Excel Data #55

Open
Ponvijaykumar opened this issue Feb 16, 2019 · 7 comments
Open

Load Json Data Or Excel Data #55

Ponvijaykumar opened this issue Feb 16, 2019 · 7 comments

Comments

@Ponvijaykumar
Copy link

Ponvijaykumar commented Feb 16, 2019

How to load existing excel date or json data

@myliang
Copy link
Owner

myliang commented Feb 16, 2019

new Spreadsheet("#x-spreadsheet-demo")
  .loadData({}) // load data (json data)
  .change(data => {
    // save data to db
  });

@Ponvijaykumar
Copy link
Author

Possible to load existing cvs or excel file.

@dodumosu
Copy link

use a library to read in the CSV or Excel data.
Some suggestions:

@wangzhedong
Copy link

加载存在数据库里的数据,你把数据转成demo中的数据格式不就可以了嘛

@Leannechn
Copy link

加载存在数据库里的数据,你把数据转成demo中的数据格式不就可以了嘛

demo中的数据格式 中的 demo 在哪里

@SheetJSDev
Copy link

SheetJSDev commented Mar 18, 2020

https://docs.sheetjs.com/docs/demos/grid#x-spreadsheet discusses in more detail

Hosted script https://cdn.sheetjs.com/xspreadsheet/xlsxspread.min.js

Script exposes a function stox. Usage:

// var grid = x_spreadsheet(...);
var wb = XLSX.read(ab);
var new_data = stox(wb); // generate x-spreadsheet data
grid.loadData(new_data); // load data into x-spreadsheet

The SheetJS documentation includes examples for how to get the ab data. For example, data can be downloaded using fetch:

// const grid = x_spreadsheet(...);
(async() => {
  const url = "https://sheetjs.com/pres.numbers";
  const ab = await (await fetch(url)).arrayBuffer();
  grid.loadData(stox(XLSX.read(ab)));
})();

@nbao
Copy link

nbao commented Nov 26, 2022

Hello how can I add a custom button to the toolbar to import/export an excel file with
https://github.com/SheetJS/sheetjs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants