forked from gnyers/python-tuesday
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathts-prototype.py
More file actions
executable file
·62 lines (43 loc) · 1.32 KB
/
ts-prototype.py
File metadata and controls
executable file
·62 lines (43 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''Demonstration of working with spreadsheets
1. Worksheet management of a given spreadsheet:
1. list the sheets
CLI args: --list-sheets WORKBOOK
2. add sheet
CLI args: --addsheet SHEETNAME WORKBOOK
2. Data management:
1. dump the data on a sheet to the stdout or a given output file as text
CLI args: --dump SHEETNAME WORKBOOK
2. append provided CSV data at the end of a sheet
CLI args: --append CSVRECORD --sheet SHEETNAME WORKBOOK
3. CLI Interface: as described above
'''
### Import modules
import sys
import os.path
### Constants
HEADER_ROW = 5 # sheet headers are assumed in this row
### Function(s) for CLI arg. parsing
def parseargs(cmdline=sys.argv[1:], known_args_only=False):
pass
### Functions implementing requirements
def list_sheets(workbook):
''' List the sheets in *workbok*
'''
pass
def add_sheet(workbook, name, index=0):
''' Create new sheet with *name* in *workbook* at position *index*
'''
pass
def append_data(sheet, data):
''' Append *data* after the last record in sheet
'''
pass
def dump_data(sheet, fd=sys.stdout):
''' Dump all data of *sheet* to file-descriptor *fd*
'''
pass
### main starts here
if __name__ == '__main__':
args = parseargs()