View definition

def Axlsx::Package#serialize

Defined in



A tremendous amount of effort has gone into ensuring that you cannot create invalid xlsx documents. confirm_valid should be used in the rare case that you cannot open the serialized file.

Serialize your workbook to disk as an xlsx document.


# This is how easy it is to create a valid xlsx file. Of course you might want to add a sheet or two, and maybe some data, styles and charts.
# Take a look at the README for an example of how to do it!

#serialize to a file
p =
# ......add cool stuff to your workbook......

# Serialize to a stream
s = p.to_stream()'example_streamed.xlsx', 'w') { |f| f.write( }


  • output (String)

    The name of the file you want to serialize your package to

  • confirm_valid (Boolean) (defaults to: false)

    Validate the package prior to serialization.

serialize is referenced in 0 repositories