{"id":11966,"date":"2019-07-26T08:00:00","date_gmt":"2019-07-25T23:00:00","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=11966"},"modified":"2020-07-03T14:12:54","modified_gmt":"2020-07-03T05:12:54","slug":"google-apps-script%e3%82%b9%e3%83%97%e3%83%ac%e3%83%83%e3%83%89%e3%82%b7%e3%83%bc%e3%83%88%e3%82%92excel%e3%83%95%e3%82%a1%e3%82%a4%e3%83%abxlsx%e3%81%ab%e5%a4%89%e6%8f%9b%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=11966","title":{"rendered":"[Google Apps Script]\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092Excel\u30d5\u30a1\u30a4\u30eb(xlsx)\u306b\u5909\u63db\u3059\u308b"},"content":{"rendered":"<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u30e1\u30cb\u30e5\u30fc \u2192 \u5f62\u5f0f\u3092\u6307\u5b9a\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9 \u2192 Microsoft Excel\uff08.xlsx\uff09 \u304b\u3089\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3067\u304d\u307e\u3059\u304c\u3001\u4e0b\u8a18URL\u306bID\u3092\u6e21\u3059\u3053\u3068\u3067\u540c\u3058\u51e6\u7406\u304c\u3067\u304d\u308b\u3053\u3068\u3092\u3001\u4eca\u3055\u3089\u306a\u304c\u3089\u306b\u77e5\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">https:\/\/docs.google.com\/spreadsheets\/d\/(\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306eID)\/export?format=xlsx<\/pre>\n<p>\u6298\u89d2\u306a\u306e\u3067\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092Excel\u30d5\u30a1\u30a4\u30eb(xlsx)\u306b\u5909\u63db\u3057\u3001\u30c9\u30e9\u30a4\u30d6\u4e0a\u306b\u4fdd\u5b58\u3059\u308b\u7c21\u5358\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3044\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306eID\u306e\u53d6\u5f97\u65b9\u6cd5\u306f\u4e0b\u8a18\u30b5\u30a4\u30c8\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"lkc-link no_icon\" href=\"https:\/\/qiita.com\/negito6\/items\/c64a7a8589faaffcfdcf\" target=\"_blank\" rel=\"external nofollow noopener\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=qiita.com\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">Qiita<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/pz-linkcard\/cache\/02f4dfc39658231e4aaf63e85060d50c9ac23fde714f079834a2f46db760351c.jpeg\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">Google Apps Script \u3067 Spreadsheet \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u65b9\u6cd5\u307e\u3068\u3081 - Qiita<\/div><div class=\"lkc-url\" title=\"https:\/\/qiita.com\/negito6\/items\/c64a7a8589faaffcfdcf\">https:\/\/qiita.com\/negito6\/items\/c64a7a8589faaffcfdcf<\/div><div class=\"lkc-excerpt\"># \u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u308a\u65b9Spreadsheet \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u308b\u65b9\u6cd5\u306f\u4e8c\u3064\u3042\u308a\u307e\u3059\u3002## \u65b9\u6cd5\u305d\u306e1. Spreadsheet \u306b\u7d10\u4ed8\u3044\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u308b\u65b9\u6cd5Container Bound Script \u3068...<\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">function myFunction() {\r\n  var id = &quot;(\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306eID)&quot;;\r\n  var excel_file = ss2xlsx(id);\r\n  if (excel_file !== undefined) {\r\n    Logger.log(&quot;Name:&quot; + excel_file.getName());\r\n  }\r\n}\r\n\r\n\/\/Spreadsheet\u3092Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3057\u3066\u30c9\u30e9\u30a4\u30d6\u306b\u4fdd\u5b58\u3001File\u3092\u8fd4\u3059\r\nfunction ss2xlsx(spreadsheet_id) {\r\n  var new_file;\r\n  var url = &quot;https:\/\/docs.google.com\/spreadsheets\/d\/&quot; + spreadsheet_id + &quot;\/export?format=xlsx&quot;;\r\n  var options = {\r\n    method: &quot;get&quot;,\r\n    headers: {&quot;Authorization&quot;: &quot;Bearer &quot; + ScriptApp.getOAuthToken()},\r\n    muteHttpExceptions: true\r\n  };\r\n  var res = UrlFetchApp.fetch(url, options);\r\n  if (res.getResponseCode() == 200) {\r\n    var ss = SpreadsheetApp.openById(spreadsheet_id);\r\n    new_file = DriveApp.createFile(res.getBlob()).setName(ss.getName() + &quot;.xlsx&quot;);\r\n  }\r\n  return new_file;\r\n}<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u554f\u984c\u304c\u7121\u3051\u308c\u3070\u540c\u540d\u306eExcel\u30d5\u30a1\u30a4\u30eb\u304c\u30c9\u30e9\u30a4\u30d6\u4e0a\u306b\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_01.jpg\" alt=\"\" width=\"958\" height=\"688\" class=\"alignnone size-full wp-image-11967\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_01.jpg 958w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_01-300x215.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_01-768x552.jpg 768w\" sizes=\"auto, (max-width: 958px) 100vw, 958px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_02.jpg\" alt=\"\" width=\"839\" height=\"522\" class=\"alignnone size-full wp-image-11968\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_02.jpg 839w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_02-300x187.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/GoogleAppsScript_Spreadsheet_To_Excel_02-768x478.jpg 768w\" sizes=\"auto, (max-width: 839px) 100vw, 839px\" \/><\/a><\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n<p>\u4e0b\u8a18\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3057\u305f\u51e6\u7406\u3067\u3059\u304c\u3001\u3053\u3061\u3089\u306f\u5909\u63db\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u76f4\u63a5\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><a class=\"lkc-link no_icon\" href=\"https:\/\/ctrlq.org\/code\/20124-convert-google-spreadsheet-to-excel\" target=\"_blank\" rel=\"external nofollow noopener\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=ctrlq.org\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">Web Geek<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/pz-linkcard\/cache\/bf2e8cf3cc4f4cd7ac589bf2ee6bf783fecb26e9c8fccda87e4671a41191c3d8.jpeg\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">Convert Google Sheet to Excel XLSX Spreadsheet<\/div><div class=\"lkc-url\" title=\"https:\/\/ctrlq.org\/code\/20124-convert-google-spreadsheet-to-excel\">https:\/\/ctrlq.org\/code\/20124-convert-google-spreadsheet-to-excel<\/div><div class=\"lkc-excerpt\">The previous example shows how to convert Google Sheets to XLS format using the Google Drive API. The response file resource includes exportLinks URLs for the various export formats for Google Spre\u2026<\/div><\/div><div class=\"clear\"><\/div><\/div><\/a><\/div><\/div>\n<h4 class=\"style4a\">\u95a2\u9023\u8a18\u4e8b<\/h4>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=12905\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Google-120x120.png' alt='[Google Apps Script]Google\u30b9\u30e9\u30a4\u30c9\u306e\u30d7\u30ec\u30bc\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4ed6\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308b' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2020.07.03<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=12905\">[Google Apps Script]Google\u30b9\u30e9\u30a4\u30c9\u306e\u30d7\u30ec\u30bc\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4ed6\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308b <\/a><\/div><div class=\"cardlink_excerpt\">\u4e45\u3057\u3076\u308a\u306bGAS\u30cd\u30bf\u3067\u3059\u3002\r\n\u30c9\u30e9\u30a4\u30d6\u306b\u3042\u308b\u8907\u6570\u306e\u30d7\u30ec\u30bc\u30f3\u30c6\u30fc\u30b7\u30e7\u30f3\u3092PowerPoint\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u3001\u624b\u4f5c\u696d\u3067\u884c\u3046\u306e\u306f\u9762\u5012\u304f\u3055\u304b\u3063\u305f\u306e\u3067\u3001\u7c21\u5358\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304f\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\r\n\r\n\u4ed5\u7d44\u307f\u306f\u4e0b\u8a18\u8a18\u4e8b\u3068\u5927\u4f53\u540c\u3058\u3067\u3059\u3002\r\n\u30d5\u30a1\u30a4\u30eb\u30e1\u30cb\u30e5\u30fc \u2192 \u30c0\u30a6...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u30e1\u30cb\u30e5\u30fc \u2192 \u5f62\u5f0f\u3092\u6307\u5b9a\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9 \u2192 Microsoft Excel\uff08.xlsx\uff09 \u304b\u3089\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092Excel\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3067\u304d\u307e\u3059\u304c\u3001\u4e0b\u8a18URL\u306bID\u3092\u6e21\u3059\u3053\u3068\u3067\u540c\u3058\u51e6\u7406\u304c\u3067\u304d [&hellip;]","protected":false},"author":1,"featured_media":7113,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[[Google Apps Script]\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092Excel\u30d5\u30a1\u30a4\u30eb(xlsx)\u306b\u5909\u63db\u3059\u308b]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[126],"tags":[],"class_list":["post-11966","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Google.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-370","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11966"}],"version-history":[{"count":2,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11966\/revisions"}],"predecessor-version":[{"id":12907,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11966\/revisions\/12907"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7113"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}