Submit Search
excelファイルをプログラムで出力しよう
Download as PPTX, PDF
0 likes
869 views
yuji0602
社内の勉強会で使った資料です。 PHPExcelとopenPyXLの簡単な利用方法です。
Engineering
Read more
1 of 17
Download now
Download to read offline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
More Related Content
PPT
Mylynとおともだち
Hiroki Kondo
PDF
Ansible モジュール 作成・配布・貢献
yaegashi
PDF
openpyxlの使い方
ysakaguchi
PDF
10080分でPythonからIP Messeneger
Satoshi Yamada
PDF
Pythonistaデビュー #PyNyumon 2016/5/31
Shinichi Nakagawa
PPTX
Jupyter Notebookを納品した話
Hiroki Yamamoto
PPTX
WordPressでExcelインポート - Word Fes 2015 -
Yuusuke Yoshida
PDF
LT3「Python を使ってExcel ファイルの修正」
Takeshi Akutsu
Mylynとおともだち
Hiroki Kondo
Ansible モジュール 作成・配布・貢献
yaegashi
openpyxlの使い方
ysakaguchi
10080分でPythonからIP Messeneger
Satoshi Yamada
Pythonistaデビュー #PyNyumon 2016/5/31
Shinichi Nakagawa
Jupyter Notebookを納品した話
Hiroki Yamamoto
WordPressでExcelインポート - Word Fes 2015 -
Yuusuke Yoshida
LT3「Python を使ってExcel ファイルの修正」
Takeshi Akutsu
Featured
(20)
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
PDF
2024 State of Marketing Report – by Hubspot
Marius Sescu
PDF
Everything You Need To Know About ChatGPT
Expeed Software
PDF
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
PDF
Skeleton Culture Code
Skeleton Technologies
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
PDF
Content Methodology: A Best Practices Report (Webinar)
contently
PPTX
How to Prepare For a Successful Job Search for 2024
Albert Qian
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
PDF
5 Public speaking tips from TED - Visualized summary
SpeakerHub
PDF
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
PDF
Getting into the tech field. what next
Tessa Mero
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
PDF
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Ad
excelファイルをプログラムで出力しよう
1.
Excelファイルを プログラムで出力しよう 2016.04.20 @yuji0602
2.
Agenda • やろうと思ったきっかけ • PHPExcelとは •
openPyXLとは • プログラムを比較してみよう • まとめ
3.
やろうと思ったきっかけ
4.
やろうと思ったきっかけ • 案件でレポートをExcelファイルでダウンロードする必要があ った。 • 外部スタッフとの共同開発に伴い、開発言語がPHPとなった 。 •
それに伴い、PHPでExcelファイルを出力する必要があった。 • ただ、PHPだけではなくpythonでも同じことが出来るのがわ かったので今回の発表に至る
5.
PHPExcelとは
6.
PHPExcelとは • PHPでExcelファイルの新規作成、読み込み、書き込み ができる • オープンソースソフトウェア(OSS) •
ライセンスはGNU LESSER GENERAL PUBLIC LICENSE(LGPL) • https://github.com/PHPOffice/PHPExcel
7.
openPyXLとは
8.
openPyXLとは • pythonでExcelファイルの新規作成、読み込み、書き込みが できる • PHPExcelを基に作られている •
こちらもOSS • ライセンスはMIT License • https://bitbucket.org/openpyxl/openpyxl
9.
プログラムを比較してみよう
10.
プログラムを比較してみよう • 簡単にプログラムを書いてみました。 • https://github.com/yuji0602/phpExcelStudy •
https://github.com/yuji0602/openPyXLStudy • バージョンは以下で行いました。 • PHP 5.6.12 • python 3.4.3
11.
プログラムを比較してみよう • PHPExcelは、composerを利用してインスト ールします。 $ vim
composer.json { "require": { "phpoffice/phpexcel": "~1.8.0" } } : wq $ composer install
12.
プログラムを比較してみよう • openPyXLは、pipを利用してインストールし ます。 $ pip
install openpyxl
13.
プログラムを比較してみよう • 簡単な使い方 PHPExcel openPyXL ワークブック作成
$excel = new PHPExcel(); wb = openpyxl.Workbook() アクティブなシートを 取得 $sheet = $excel->getActiveSheet(); ws = wb.active シートのタイトル設定 $sheet->setTitle('Test'); ws.title = 'Test' 表示幅の設定 $sheet->getColumnDimension('A')->setWidth(13); ws.column_dimensions['A'].width = 13 セルに文字を出力 $sheet->setCellValue('A1', '=ROW()-1'); ws.cell(row=1, column=1).value = '=ROW()-1' ファイル保存 $writer = PHPExcel_IOFactory::createWriter($excel, 'Excel2007'); $writer->save('output.xlsx'); wb.save(filename='output.xlsx')
14.
プログラムを比較してみよう • その他に以下のことが可能 • セルの色を変更 •
条件式の設定 • チャートを表示
15.
まとめ
16.
まとめ • PHPやpythonで同じようにExcelファイルを作 成できる • 利用シーンに応じて使い分けすることが出来 る •
どちらもオープンソースなので不具合とか改 善点を見つけたら修正していきたいところ
17.
おわり
Download