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

Is there a way inserting values in columns. #514

Closed
miniil opened this issue Mar 13, 2018 · 4 comments
Closed

Is there a way inserting values in columns. #514

miniil opened this issue Mar 13, 2018 · 4 comments

Comments

@miniil
Copy link

miniil commented Mar 13, 2018

Hi,

I want to insert multiple values into one colum based on its header.

For example :

var myValues = [1, 2, 3, 4];
var thisColumn = sheet.getColumn('idCol');
thisColumn.value = myValues?

and the result will be something like this
idCol
1
2
3
4

Thanks for your help.

@vshreyas-tricog
Copy link

you can do it by array of object's
like
var rows = [];
var row = {
col_name : value
};
rows.push(row);
sheet_name.addRow(rows);

i hope this may work for you

@miniil
Copy link
Author

miniil commented Mar 14, 2018

Hi,

Thanks for your response but it's not exactly what I have to do.

Because I open an existing file with many columns and I have to add a column at the end to append data.

Thanks for your help.

@guyonroche
Copy link
Collaborator

@miniil I have just added a values property to Column (as of v1.1.0)
So now you can:

thisColumn.values = ['values', 'will', 'be', 'added', 'to', 'thisColumn'];

@dmk1111
Copy link

dmk1111 commented Oct 27, 2023

@guyonroche looks like it is readonly array as of 4.4.0: values: ReadonlyArray<CellValue>;
Any idea how to handle this properly now?

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

5 participants