Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mobile-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Night of Science
mobile-app
Commits
18b6ebb2
Commit
18b6ebb2
authored
7 years ago
by
wonko
Browse files
Options
Downloads
Patches
Plain Diff
vortraege aus google sheet direct in json
parent
09dddcbc
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
orga/planconvert.py
+27
-20
27 additions, 20 deletions
orga/planconvert.py
src/src/assets/data/lectures.json
+135
-130
135 additions, 130 deletions
src/src/assets/data/lectures.json
with
162 additions
and
150 deletions
orga/planconver.py
→
orga/planconver
t
.py
+
27
−
20
View file @
18b6ebb2
from
openpyxl
import
load_workbook
import
gspread
import
json
import
json
wb
=
load_workbook
(
filename
=
'
vortragsplan-17.5..xlsx
'
)
from
oauth2client.service_account
import
ServiceAccountCredentials
ws
=
wb
[
'
Tabelle1
'
]
scope
=
[
'
https://spreadsheets.google.com/feeds
'
]
credentials
=
ServiceAccountCredentials
.
from_json_keyfile_name
(
'
gsheets.json
'
,
scope
)
gc
=
gspread
.
authorize
(
credentials
)
ws
=
gc
.
open
(
"
vortragsplan-beta
"
).
sheet1
rooms
=
[]
rooms
=
[]
...
@@ -16,19 +25,17 @@ def cval(cell):
...
@@ -16,19 +25,17 @@ def cval(cell):
cv
=
cv
.
strip
()
cv
=
cv
.
strip
()
return
cv
return
cv
for
rows
in
ws
.
iter_cols
(
min_col
=
2
,
min_row
=
1
,
max_row
=
1
):
for
cell
in
ws
.
range
(
1
,
1
,
1
,
20
):
for
cell
in
rows
:
room
=
cval
(
cell
)
room
=
cval
(
cell
)
if
room
:
room
=
room
.
strip
()
if
room
:
if
room
:
room
=
room
.
strip
()
rooms
.
append
(
cell
)
if
room
:
rooms
.
append
(
cell
)
for
rows
in
ws
.
iter_rows
(
min_col
=
1
,
min_row
=
1
,
max_row
=
ws
.
max_row
+
1
,
max_col
=
1
):
for
cell
in
ws
.
range
(
1
,
1
,
200
,
1
):
for
cell
in
rows
:
time
=
cval
(
cell
)
time
=
cval
(
cell
)
if
time
:
if
time
:
times
.
append
(
cell
)
times
.
append
(
cell
)
for
room
in
rooms
:
for
room
in
rooms
:
...
@@ -40,21 +47,21 @@ for room in rooms:
...
@@ -40,21 +47,21 @@ for room in rooms:
timeslot
=
{
'
time
'
:
time
.
value
,
'
begin
'
:
be
[
0
].
strip
(),
'
end
'
:
be
[
1
].
strip
()}
timeslot
=
{
'
time
'
:
time
.
value
,
'
begin
'
:
be
[
0
].
strip
(),
'
end
'
:
be
[
1
].
strip
()}
lecture
=
{}
lecture
=
{}
col
=
room
.
col
_idx
col
=
room
.
col
row
=
time
.
row
row
=
time
.
row
fs
=
cval
(
ws
.
cell
(
row
=
row
,
col
umn
=
col
))
fs
=
cval
(
ws
.
cell
(
row
=
row
,
col
=
col
))
if
fs
:
if
fs
:
lecture
[
'
fs
'
]
=
fs
lecture
[
'
fs
'
]
=
fs
titel
=
cval
(
ws
.
cell
(
row
=
row
+
1
,
col
umn
=
col
))
titel
=
cval
(
ws
.
cell
(
row
=
row
+
1
,
col
=
col
))
if
titel
:
if
titel
:
lecture
[
'
titel
'
]
=
titel
lecture
[
'
titel
'
]
=
titel
name
=
cval
(
ws
.
cell
(
row
=
row
+
2
,
col
umn
=
col
))
name
=
cval
(
ws
.
cell
(
row
=
row
+
2
,
col
=
col
))
if
name
:
if
name
:
lecture
[
'
name
'
]
=
name
lecture
[
'
name
'
]
=
name
teaser
=
cval
(
ws
.
cell
(
row
=
row
+
3
,
col
umn
=
col
))
teaser
=
cval
(
ws
.
cell
(
row
=
row
+
3
,
col
=
col
))
if
teaser
:
if
teaser
:
lecture
[
'
teaser
'
]
=
teaser
lecture
[
'
teaser
'
]
=
teaser
aufz
=
cval
(
ws
.
cell
(
row
=
row
+
3
,
col
umn
=
col
))
aufz
=
cval
(
ws
.
cell
(
row
=
row
+
3
,
col
=
col
))
if
aufz
:
if
aufz
:
lecture
[
'
aufz
'
]
=
aufz
lecture
[
'
aufz
'
]
=
aufz
...
...
This diff is collapsed.
Click to expand it.
src/src/assets/data/lectures.json
+
135
−
130
View file @
18b6ebb2
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment