{"id":199,"date":"2010-03-25T01:49:28","date_gmt":"2010-03-24T16:49:28","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2010\/03\/25\/google_app_engine_excel\/"},"modified":"2010-03-25T01:49:28","modified_gmt":"2010-03-24T16:49:28","slug":"google_app_engine_excel","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2010\/03\/25\/google_app_engine_excel\/","title":{"rendered":"Google App Engine \u3067 Excel \u3092\u4f5c\u6210\u3057\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u305b\u308b"},"content":{"rendered":"<p>\u5148\u65e5\u3001<a href=\"\/blg\/glob\/2010\/02\/_cocomo_1.html\" target=\"_blank\">COCOMO\u306b\u3088\u308b\u5de5\u6570\u8a08\u7b97 \u304a\u3088\u3073\u3001\u30d5\u30a1\u30f3\u30af\u30b7\u30e7\u30f3\u30dd\u30a4\u30f3\u30c8 \u3092\u4f7f\u3063\u305f\u898b\u7a4d\u30c4\u30fc\u30eb\u3092\u4f5c\u6210<\/a>\u3057\u305f\u304c\u3001\u305d\u308c\u306b Excel \u3067\u7d50\u679c\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u6a5f\u80fd\u3092\u7d44\u307f\u8fbc\u307f\u305f\u3044\u3068\u601d\u3046\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel01.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"gae_excel01\" border=\"0\" alt=\"gae_excel01\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel01_thumb.jpg\" width=\"330\" height=\"121\"><\/a> <\/p>\n<h2>pyExcelerator \u3067\u306f\u306a\u304f\u3066 xlwt \u3092\u4f7f\u3046<\/h2>\n<p><a href=\"http:\/\/code.google.com\/intl\/ja\/appengine\/docs\/python\/howto\/usinggdataservices.html\" target=\"_blank\">Google Data \u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3059\u308b\u3068\u3001Google\u3000Document \u7b49\u3082\u4f5c\u6210\u3067\u304d\u308b\u3088\u3046<\/a>\u3060\u304c\u3001\u307e\u305a\u306f\u3001Excel \u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3088\u3046\u306b\u3002<\/p>\n<p>Excel \u306b\u7d50\u679c\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308c\u3070\u3001\u4f7f\u3044\u52dd\u624b\u3082\u4e0a\u304c\u308b\u304b\u306a\uff5e\u3068\u3002<\/p>\n<p>\u307e\u305a\u3001Python\u304b\u3089\u3001Excel\u3092\u4f7f\u3046\u306b\u306f\u3001pyExcelerator \u3060\u3068\u601d\u3044\u3001\u3057\u305f\u3057\u3089\u3079\u3057\u3066\u3044\u305f\u3089\u3001\u3069\u3046\u3082\u3001<a href=\"http:\/\/japan.internet.com\/developer\/20080613\/26.html\" target=\"_blank\">\u76f4\u63a5\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u30b9\u30c8\u30ea\u30fc\u30e0\u306b Excel \u30ef\u30fc\u30af\u30d6\u30c3\u30af\u3092\u66f8\u304d\u8fbc\u307f\u3067\u304d\u306a\u3044<\/a>\u3088\u3046\u3060\u3002<\/p>\n<p>\u81ea\u5b85\u30b5\u30fc\u30d0\u30fc\u306a\u3089\u3001\u4e00\u6642\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u624b\u3082\u3042\u308b\u3060\u308d\u3046\u304c\u3001\u76f8\u624b\u306fGAE\u3060\u3057\u3001\u4e00\u6642\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u3089\u306a\u304d\u3083\u3044\u3051\u306a\u3044\u306e\u306f\u3044\u305f\u3060\u3051\u306a\u3044\u3002<\/p>\n<p>\u3082\u3046\u5c11\u3057\u8abf\u3079\u308b\u3068\u3001\u3069\u3046\u3082\u3059\u3067\u306b <a href=\"http:\/\/stackoverflow.com\/questions\/1886744\/use-pyexcelerator-to-generate-dynamic-excel-file-with-django-ensure-unique-tempo\" target=\"_blank\">pyExcelerator \u306f\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u3055\u308c\u3066\u304a\u3089\u305a<\/a>\u3001\u305d\u3053\u304b\u3089\u30d5\u30a9\u30fc\u30af\u3057\u305f\u3001<a href=\"http:\/\/pypi.python.org\/pypi\/xlwt\" target=\"_blank\">xlwt<\/a> \u306e\u65b9\u304c\u73fe\u5728\u958b\u767a\u7d99\u7d9a\u4e2d\u3067\u6a5f\u80fd\u3082\u8c4a\u5bcc\u306a\u3088\u3046\u3060\u3002\u305d\u3061\u3089\u3092\u4f7f\u3063\u3066\u307f\u308b\u3053\u3068\u3068\u3059\u308b\u3002<\/p>\n<h2><\/h2>\n<h2>Zip \u30a4\u30f3\u30dd\u30fc\u30c8<\/h2>\n<p><a href=\"\/blg\/glob\/2009\/09\/gae_django.html\" target=\"_blank\">GAE \u306b\u306f\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u306b\u4e0a\u9650\u304c\u3042\u308a<\/a>\u3001\u30d5\u30a1\u30a4\u30eb\u6570\u304c\u591a\u3044\u3068\u304d\u306a\u3069\u306f\u3001<a href=\"http:\/\/code.google.com\/intl\/ja\/appengine\/articles\/django10_zipimport.html\" target=\"_blank\">Zip\u30a4\u30f3\u30dd\u30fc\u30c8\u3092\u4f7f\u7528<\/a>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u6570\u3092\u7a3c\u3052\u308b\u3002<\/p>\n<p>\u521d\u56de\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\u6642\u306b\u3001\u5c55\u958b\u3055\u308c\u308b\u304c\u4ee5\u964d\u306f\u30e1\u30e2\u30ea\u306b\u30ad\u30e3\u30c3\u30b7\u30e5\u3055\u308c\u3001\u540c\u3058\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u5bfe\u3057\u3066\u306f\u3001\u305d\u306e\u5f8c\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u306f\u767a\u751f\u3057\u306a\u3044\u3068\u306e\u3053\u3068\u3002<\/p>\n<p>xlwt \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3001\u89e3\u51cd\u3057\u3001built\/lib \u4ee5\u4e0b\u306e\u30d5\u30a9\u30eb\u30c0\u3092 zip \u5727\u7e2e\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel02.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"gae_excel02\" border=\"0\" alt=\"gae_excel02\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel02_thumb.jpg\" width=\"219\" height=\"164\"><\/a> <\/p>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u30eb\u30fc\u30c8\u30d5\u30a9\u30eb\u30c0\u306b\u914d\u7f6e\uff08Exclepse \uff0b PyDev)<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel03.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"gae_excel03\" border=\"0\" alt=\"gae_excel03\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel03_thumb.jpg\" width=\"273\" height=\"224\"><\/a> <\/p>\n<h2>\u5b9f\u88c5<\/h2>\n<p>\u8a66\u3057\u306b\u3001xlwt \u306e\u30b5\u30f3\u30d7\u30eb\u3001xlwt-0.7.2\\xlwt-0.7.2\\xlwt\\examples\\mini.py&nbsp; \u306e\u5185\u5bb9\u3092\u51fa\u529b\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>sys.path.insert \u3067\u3001zip import \u3092\u884c\u3046\u3002<\/p>\n<pre class=\"prettyprint linenums\">import sys\r\n#sys.path.insert(0, 'gdata.zip')\r\nsys.path.insert(0, 'xlwt.zip')\r\n\r\nimport xlwt\r\n\r\nimport os\r\nfrom google.appengine.ext import webapp\r\n\r\nclass DownloadResponse(webapp.RequestHandler):\r\n    def get(self):\r\n        self.post()\r\n        \r\n    def post(self):\r\n        self.response.headers.add_header(\"Content-Disposition\", 'attachment; filename=\"foo.xls\"' )\r\n        wb = xlwt.Workbook()\r\n        ws = wb.add_sheet('xlwt was here')\r\n        wb.save(self.response.out)\r\n        return None\r\n<\/pre>\n<p>Workbook.save \u30e1\u30bd\u30c3\u30c9\u306b\u3001Response.out \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6e21\u3057\u3066\u3044\u308b\u304c\u3001\u5f15\u6570\u3068\u3057\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u69d8\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u3068\u308b\u3088\u3046\u3060\u3002<\/p>\n<p>CompoundDoc.py \u3092\u53c2\u7167\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b7\u30b0\u30cd\u30c1\u30e3\u3067\u3001file_name_or_filelike_obj \u306b\u5bfe\u3057\u3066\u547c\u3070\u308c\u3066\u3044\u308b\u306e\u306f\u3001open \u3068 write <\/p>\n<pre class=\"prettyprint linenums\">def save(self, file_name_or_filelike_obj, stream):\r\n<\/pre>\n<p><a href=\"http:\/\/code.google.com\/intl\/ja\/appengine\/docs\/python\/tools\/webapp\/responseclass.html\" target=\"_blank\">Response \u30af\u30e9\u30b9 \u306e out<\/a> \u306f\u3001<a href=\"http:\/\/docs.python.org\/library\/stringio.html\" target=\"_blank\">StringIO<\/a>\u3000\u306a\u306e\u3067\u3001\u3044\u3051\u308b\u3060\u308d\u3046\u3002<\/p>\n<p>\u5b9f\u884c\u3057\u3066\u307f\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel04.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px\" title=\"gae_excel04\" border=\"0\" alt=\"gae_excel04\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel04_thumb.jpg\" width=\"291\" height=\"158\"><\/a>&nbsp; <\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306e\u30c0\u30a4\u30a2\u30ed\u30b0\u304c\u958b\u3044\u305f\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel05.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px\" title=\"gae_excel05\" border=\"0\" alt=\"gae_excel05\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/GoogleAppEngineExcel_11EE\/gae_excel05_thumb.jpg\" width=\"385\" height=\"290\"><\/a> <\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067 Excel \u3092\u958b\u304f\u3053\u3068\u304c\u3067\u304d\u305f\u3002<\/p>\n<p>\u3042\u3068\u306f\u3001\u529b\u696d\u304b\u306a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u65e5\u3001COCOMO\u306b\u3088\u308b\u5de5\u6570\u8a08\u7b97 \u304a\u3088\u3073\u3001\u30d5\u30a1\u30f3\u30af\u30b7\u30e7\u30f3\u30dd\u30a4\u30f3\u30c8 \u3092\u4f7f\u3063\u305f\u898b\u7a4d\u30c4\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u305f\u304c\u3001\u305d\u308c\u306b Excel \u3067\u7d50\u679c\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u6a5f\u80fd\u3092\u7d44\u307f\u8fbc\u307f\u305f\u3044\u3068\u601d\u3046\u3002 pyExcelerator \u3067\u306f\u306a\u304f\u3066 xlwt  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[19,20],"tags":[],"class_list":["post-199","post","type-post","status-publish","format-standard","hentry","category-googleappengine","category-python"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=199"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/199\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}