Skip to content

Instantly share code, notes, and snippets.

@matt-dray
Created September 21, 2023 08:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matt-dray/d22163d5effc61e2a88085c185212db6 to your computer and use it in GitHub Desktop.
Save matt-dray/d22163d5effc61e2a88085c185212db6 to your computer and use it in GitHub Desktop.
Freeing Brian Bilston's spreadsheet-based 'Cells' poem
# Freeing Brian Bilston's spreadsheet-based 'Cells' poem
# https://x.com/brian_bilston/status/1704061266979959099?s=46&t=QpOVBfS2sVIbcjn3ZLif3g
# Assuming the poem is saved to the file cells.xlsx
cells <- tidyxl::xlsx_cells("cells.xlsx", include_blank_cells = FALSE)
txt <- cells$character
txt_len <- length(txt)
author <- paste0("-", txt[txt_len])
txt <- txt[-txt_len]
lines <- split(txt, ceiling(seq_along(txt) / max(cells$col))) |> append(author)
lapply(lines, \(x) paste(x, collapse = " ")) |> unlist() |> cat(sep = "\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment