auto_auto_archive.py 695 B

1234567891011121314151617181920212223242526272829
  1. import tempfile
  2. import auto_archive
  3. from loguru import logger
  4. from configs import Config
  5. from storages import Storage
  6. def main():
  7. c = Config()
  8. c.parse()
  9. logger.info(f'Opening document {c.sheet} to look for sheet names to archive')
  10. gc = c.gsheets_client
  11. sh = gc.open(c.sheet)
  12. wks = sh.get_worksheet(0)
  13. values = wks.get_all_values()
  14. with tempfile.TemporaryDirectory(dir="./") as tmpdir:
  15. Storage.TMP_FOLDER = tmpdir
  16. for i in range(11, len(values)):
  17. c.sheet = values[i][0]
  18. logger.info(f"Processing {c.sheet}")
  19. auto_archive.process_sheet(c)
  20. c.destroy_webdriver()
  21. if __name__ == "__main__":
  22. main()