Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
aa.gusti
/
opensipkd-tools
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3d2826b1
authored
Mar 01, 2026
by
aa.gustiana@gmail.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
penambahan xls response
1 parent
b72604fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
opensipkd/tools/report.py
opensipkd/tools/report.py
View file @
3d2826b
...
...
@@ -254,6 +254,21 @@ def csv_response(request, value, filename=None):
return
response
def
xls_response
(
request
,
value
,
filename
=
None
):
if
not
filename
:
filename
=
get_random_string
(
20
)
+
".xls"
response
=
request
.
response
response
.
content_type
=
'application/xls'
response
.
content_disposition
=
'filename='
+
filename
from
pandas
import
DataFrame
df
=
DataFrame
(
value
.
get
(
'rows'
,
[]),
columns
=
value
.
get
(
'header'
,
[]))
df
.
to_excel
(
filename
,
index
=
False
)
with
open
(
filename
,
'rb'
)
as
f
:
response
.
write
(
f
.
read
())
return
response
def
terbilang
(
bil
):
angka
=
[
""
,
"Satu"
,
"Dua"
,
"Tiga"
,
"Empat"
,
"Lima"
,
"Enam"
,
"Tujuh"
,
"Delapan"
,
"Sembilan"
,
"Sepuluh"
,
"Sebelas"
]
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment