Enable Shared String Tables (SST) for deduplication
masterIf your dataset contains highly repetitive strings, you can enable Shared String Tables (SST) to reduce file size. This can be enabled for the entire workbook or for a specific worksheet using the use_shared_strings: true option.
Warning: The SST is kept in memory. Do not enable this if you have a massive number of rows or very little duplication, as it may lead to high memory usage.
xlsx.write_worksheet(name: 'SheetWithSST', use_shared_strings: true) do |sheet|
sheet << ['the', 'same', 'old', 'story']
sheet << ['the', 'old', 'same', 'story']
end