Replying to myself in case anyone else comes here looking for the same thing, it took quite some googling but there is an easy solution: I found it's actually trivial to do with the "rb-appscript" gem:
require 'appscript'
excel = Appscript.app("Microsoft Excel")
excel.open("/Users/myself/unprotected.xlsx")
excel.active_workbook.password.set "secret"
excel.active_workbook.save_workbook_as(:filename => "protected.xlsx")
excel.active_workbook.close