fast_excel icon indicating copy to clipboard operation
fast_excel copied to clipboard

Make it possible to add column

Open marisveide opened this issue 8 years ago • 1 comments

This is very promising solution to Axlsx, if it would only have the possibility to add columns in the middle of file generation process. We have this process of generating large Excel files, which also need to dynamically add columns, if certain data appears.

How could that be possible to achieve that result?

marisveide avatar Dec 05 '17 22:12 marisveide

Hello @marisveide

Yes it's possible, somehow like this:

workbook = FastExcel.open(constant_memory: false) # must be constant_memory: false
worksheet = workbook.add_worksheet("Example Report")

worksheet.write_value(0, 10, "Column 10") # adding new column name
worksheet.write_value(123, 10, "Value 10") # writing value

workbook.read_string # result

When constant_memory: true it will write parts to disk and we can't update rows that already been written.

Paxa avatar Jan 09 '18 07:01 Paxa