Change the value of a specific cell using the Axlsx array, taking into account the column number and row number

I am trying to use asxlx gem to write an excel sheet, but I failed miserably with an attempt to access individual cell values.

For example, to get the value of cell 2 in column 2

How to change the value of cell 10 in column 19 ??

+4
source share
1 answer

You must have access to the value of any given cell through standard index links.

Trivial example:

p = Axlsx::Package.new ws = p.workbook.add_worksheet ws.add_row [1, 2, 3, 4] ws.rows[0].cells[1].value = 5 

sets the value of the second cell in the first row to 5

Please note, however, that axlsx is a rare generator. You cannot arbitrarily set a value for a cell that has not been added to the sheet via add_row.

+11
source

Source: https://habr.com/ru/post/1496474/


All Articles