mirror of
https://github.com/FAUSheppy/ths-reference-data-collector
synced 2025-12-06 06:51:35 +01:00
add parser & fix some whitespaces
This commit is contained in:
12
main.py
12
main.py
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import argparse
|
||||
import datetime as dt
|
||||
import dateutil.relativedelta
|
||||
import os
|
||||
@@ -150,16 +151,25 @@ class Data:
|
||||
return "Data: {} {} {}".format(self.dtype, self.time, self.value)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# parse arguments #
|
||||
parser = argparse.ArgumentParser(description='Reference Data Collector DWD')
|
||||
parser.add_argument('--target-file', default="Weatherdata.xlsx", help='File(-path) to save to')
|
||||
args = parser.parse_args()
|
||||
|
||||
# check laste months #
|
||||
checkLastMonths()
|
||||
|
||||
# read in csv's #
|
||||
globPattern = "{}/*.csv".format(CSV_DIR)
|
||||
sheets = {}
|
||||
for f in glob.glob(globPattern):
|
||||
sheet = pyexcel.get_sheet(file_name=f, delimiter=";")
|
||||
sheets.update({ os.path.basename(f) : sheet })
|
||||
|
||||
# open & save spreadsheet book #
|
||||
book = pyexcel.get_book(bookdict=sheets)
|
||||
outfileRaw = "Wetterdaten.xlsx"
|
||||
outfileRaw = args.target_file
|
||||
book.save_as(outfileRaw)
|
||||
|
||||
# formating and style #
|
||||
|
||||
Reference in New Issue
Block a user