## Create a new workbook
wb <- wb_workbook()
## Add a worksheet
wb$add_worksheet("Sheet 1")
## set col widths
wb$set_col_widths(1, cols = c(1, 4, 6, 7, 9), widths = c(16, 15, 12, 18, 33))
## auto columns
wb$add_worksheet("Sheet 2")
wb$add_data(sheet = 2, x = iris)
wb$set_col_widths(sheet = 2, cols = 1:5, widths = "auto")
Run the code above in your browser using DataLab