add test for libs and refactor spreadsheet.py