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

Append more values to sharedStrings of workbook #164

Open
NayOoLwin5 opened this issue Jun 29, 2022 · 7 comments
Open

Append more values to sharedStrings of workbook #164

NayOoLwin5 opened this issue Jun 29, 2022 · 7 comments

Comments

@NayOoLwin5
Copy link

My workbook is already loaded with values and placeholders. The total of sharedStrings is now 530. I would like to add(append) more values to the sharedStrings along with a loop.

@kant2002
Copy link
Collaborator

This is library for report generation, why do you want to put values into sharedStrings using it?

@NayOoLwin5
Copy link
Author

NayOoLwin5 commented Jun 29, 2022

Hi @kant2002, I am also using it for report generation. In my case, I am delaying the values parsed into template.substitute() by a second using mqtt. The values are 100 rows each second and the total is 1500.
It does not work as expected. The workbook remains same with first 100 rows. Is there anyway like appending values to the workbook?

@kant2002
Copy link
Collaborator

Aah, now it make sense, so you essentially want stream substitution process. And be able append more substitution values over and over again until you done. Is this correct?

Example

var batch1 = [
    {name: "John Smith", age: 20},
    {name: "Bob Johnson", age: 22}
];

// Perform substitution
template.substitute(sheetNumber, values);

var batch2 = [
    {name: "Andrii Hopak", age: 33},
    {name: "Marat Beysabekov", age: 52}
];

// Feed additional data to substitution process
template.continueSubstitute(sheetNumber, values);

@NayOoLwin5
Copy link
Author

It is throwing this error -

debug: TypeError: template.continueSubstitute is not a function

@kant2002
Copy link
Collaborator

There no such functionality in the library at the moment. You have to collect all data into one object, and if you are done, then perform substitution.

@NayOoLwin5
Copy link
Author

Understood @kant2002. In addition, does this library support merging multiple excel files into one? If it does, it solves my issue.

@kant2002
Copy link
Collaborator

No, merging of XLSX files should happens via other means. This library is for simple template substitution.

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

2 participants