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

Can extract data from the sheet #2030

Open
ramusesan opened this issue Feb 2, 2023 · 7 comments
Open

Can extract data from the sheet #2030

ramusesan opened this issue Feb 2, 2023 · 7 comments

Comments

@ramusesan
Copy link

ramusesan commented Feb 2, 2023

hi, I found this lib is very useful. am looking for a library where we can store and retrieve the data from the sheet is this possible with this library,i am not able to see anything relevant extract data from the sheet and store in DB

@LucasLefevre
Copy link
Collaborator

Hello @ramusesan
Are you looking for a way to save the state of the sheet and store it in a DB? With the goal to re-open the spreadsheet later with the data?
Did I understand correctly ?

If that's what you are looking for, you can use the exportData() method on the model. The spreadsheet state is a json data structure.

const model = new Model(...);

// when you want to retrieve the spreadsheet data
const data = model.exportData();
// now you can do whatever you want with the data, including saving it to a database

@rrahir
Copy link
Collaborator

rrahir commented Apr 17, 2023

Without any update for two months, I will close this issue.

Regards

@rrahir rrahir closed this as completed Apr 17, 2023
@saifkazi
Copy link

Hello @ramusesan Are you looking for a way to save the state of the sheet and store it in a DB? With the goal to re-open the spreadsheet later with the data? Did I understand correctly ?

If that's what you are looking for, you can use the exportData() method on the model. The spreadsheet state is a json data structure.

const model = new Model(...);

// when you want to retrieve the spreadsheet data
const data = model.exportData();
// now you can do whatever you want with the data, including saving it to a database

I tried this but I cannot get the data from Cells which has formula in it

@LucasLefevre
Copy link
Collaborator

Do you mean you don't get the cell values (evaluated formulas)?

@LucasLefevre LucasLefevre reopened this May 19, 2023
@saifkazi
Copy link

saifkazi commented May 19, 2023

Do you mean you don't get the cell values (evaluated formulas)?

That is exactly what I wanted evaluated(or should I say computed ?) values . so I can put that in my db
I tried model.getters.getCell("Sheet1",1,12) I am getting the formula but evaluated object shows value "Loading..."

@saifkazi
Copy link

saifkazi commented May 21, 2023

Do you mean you don't get the cell values (evaluated formulas)?

That is exactly what I wanted evaluated(or should I say computed ?) values . so I can put that in my db I tried model.getters.getCell("Sheet1",1,12) I am getting the formula but evaluated object shows value "Loading..."

Update :

I just set my model mode from headless to normal and it worked but only for
one sheet while the evaluated data in other sheets shows 'Loading'

 const model = await new Model(data, {
            mode: "normal",
        });

Update 2:

I need to evaluate Cells in loop and it worked

var sheets = model.getters.getSheets()
for (let index = 0; index < sheets.length; index++) {
            await model.dispatch("EVALUATE_CELLS", { sheetId: sheets[index].id})
        }

@LucasLefevre
Copy link
Collaborator

Which version are you using ? (I strongly suggest using 16.0 or the latest 16.3)

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

4 participants