{
    "componentChunkName": "component---src-templates-blog-post-js",
    "path": "/2022-03-02_google_spreadsheet_download_csv/",
    "result": {"data":{"site":{"siteMetadata":{"title":"365"}},"markdownRemark":{"id":"6da67105-bd76-5020-86bb-389c86cb7412","excerpt":"下記のような URL に変換してアクセスすれば CSV を取得することができる こんなスプレッドシートの内容なら 列1 列2 列3 あ い う え お か き く け 下記のテキストデータになる もともとのきっかけは複数の Google…","html":"<p>下記のような URL に変換してアクセスすれば CSV を取得することができる</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">https://docs.google.com/spreadsheets/d/{{ gooogle_spreadsheets_id }}/gviz/tq?tqx=out:csv&amp;sheet={{ sheet_name }}</code></pre></div>\n<p>こんなスプレッドシートの内容なら</p>\n<table>\n<thead>\n<tr>\n<th>列1</th>\n<th>列2</th>\n<th>列3</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>あ</td>\n<td>い</td>\n<td>う</td>\n</tr>\n<tr>\n<td>え</td>\n<td>お</td>\n<td>か</td>\n</tr>\n<tr>\n<td>き</td>\n<td>く</td>\n<td>け</td>\n</tr>\n</tbody>\n</table>\n<p>下記のテキストデータになる</p>\n<div class=\"gatsby-highlight\" data-language=\"sh\"><pre class=\"language-sh\"><code class=\"language-sh\">&quot;列1&quot;,&quot;列2&quot;,&quot;列3&quot;\r\n&quot;あ&quot;,&quot;い&quot;,&quot;う&quot;\r\n&quot;え&quot;,&quot;お&quot;,&quot;か&quot;\r\n&quot;き&quot;,&quot;く&quot;,&quot;け&quot;</code></pre></div>\n<p>もともとのきっかけは複数の Google スプレッドシートの中身を確認して処理をしたかった<br>\nプログラムで処理するときは OAuth 認証経由で Google ドライブにアクセスして ID を取得して操作することになりそうだが、時間がかかりそうだったのでスキップ<br>\n今回は結局スプレッドシートにアクセスしてファイルからカンマ区切り形式でダウンロードする形にした</p>\n<p>今回は行データのみだけど結合とかされているデータなどはどうなるのかは未検証</p>\n<p>参考</p>\n<ul>\n<li><a href=\"https://stackoverflow.com/questions/37705553/how-to-export-a-csv-from-google-sheet-api\">r googlesheets - How to export a csv from Google Sheet API? - Stack Overflow</a></li>\n</ul>","frontmatter":{"title":"Google スプレッドのシートの内容を CSV でダウンロードする","date":"2022/03/02","description":null}},"previous":{"fields":{"slug":"/2022-02-18_character_code_nkf/"},"frontmatter":{"title":"ターミナルで文字コードを確認して変更する"}},"next":{"fields":{"slug":"/2022-03-03_mac_ssh_key/"},"frontmatter":{"title":"macOS の SSH 接続時の秘密鍵パスワードを Keychain に保存する"}}},"pageContext":{"id":"6da67105-bd76-5020-86bb-389c86cb7412","previousPostId":"f3747698-bde1-5467-893b-4b55ed402c42","nextPostId":"fdafa77a-6c2b-5f35-b954-ffc62e87e061"}},
    "staticQueryHashes": ["2841359383","3257411868"]}