<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>とりとめもないこと | マミオン有限会社-パソコン・数学研修、法人研修</title>
	<atom:link href="https://mamion.net/category/%E3%81%A8%E3%82%8A%E3%81%A8%E3%82%81%E3%82%82%E3%81%AA%E3%81%84%E3%81%93%E3%81%A8/feed/" rel="self" type="application/rss+xml" />
	<link>https://mamion.net</link>
	<description>大人向けのパソコンおよび数学研修を実施。対面、オンライン対応。コンテンツ提供なども</description>
	<lastBuildDate>Sat, 11 Oct 2025 07:59:25 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>蔵書をスマホでスキャンして管理する</title>
		<link>https://mamion.net/2025/10/library-catalog-management/</link>
		
		<dc:creator><![CDATA[staff]]></dc:creator>
		<pubDate>Sat, 11 Oct 2025 07:56:00 +0000</pubDate>
				<category><![CDATA[とりとめもないこと]]></category>
		<guid isPermaLink="false">https://mamion.net/?p=12349</guid>

					<description><![CDATA[<p>蔵書をスマホでスキャンして一覧にしたいなあと思い、生成AIに手伝ってもらいながら、アプリを作成したのでメモ。この記事もほとんど生成AIが書いています。会社とは関係ありません。本記事についてのお問い合わせをいただいてもお答 [&#8230;]</p>
The post <a href="https://mamion.net/2025/10/library-catalog-management/">蔵書をスマホでスキャンして管理する</a> first appeared on <a href="https://mamion.net">マミオン有限会社-パソコン・数学研修、法人研修</a>.]]></description>
										<content:encoded><![CDATA[<p>蔵書をスマホでスキャンして一覧にしたいなあと思い、生成AIに手伝ってもらいながら、アプリを作成したのでメモ。この記事もほとんど生成AIが書いています。<br>会社とは関係ありません。本記事についてのお問い合わせをいただいてもお答えしかねます。ご了承ください。</p>



<p>参考URL：<a href="http://AppSheetと25行のGoogle Apps Scriptで作るバーコード蔵書管理アプリ" title="">https://qiita.com/takatama/items/8c4f7f657d9925cde57f</a></p>



<h2 class="wp-block-heading"><strong>前提条件</strong></h2>



<ul class="wp-block-list">
<li>Googleアカウント</li>



<li>スマートフォン（バーコードスキャン用）</li>



<li>基本的なスプレッドシート操作知識</li>
</ul>



<h2 class="wp-block-heading"><strong>1. Google Sheetsの準備</strong></h2>



<h3 class="wp-block-heading"><strong>1.1 メインスプレッドシートの作成</strong></h3>



<ol class="wp-block-list">
<li><strong>新しいGoogle Sheetsを作成</strong><strong><br></strong>
<ul class="wp-block-list">
<li>スプレッドシート名: MyLibrary（何でもよい）</li>



<li>1つ目のシート名を Books に変更（これはコード内で指定しているので絶対）</li>
</ul>
</li>
</ol>



<p><strong>Books シートの列設定</strong> A列からI列に以下のヘッダーを設定：<br><br>ISBN | title | subtitle | authors | publisher | publishedDate | description | thumbnail | createdAt</p>



<ol start="2" class="wp-block-list">
<li><strong>テスト用データの準備<br></strong>
<ul class="wp-block-list">
<li>A2セルに 9784295021674 を入力（後でテスト用に使用）</li>
</ul>
</li>
</ol>



<h2 class="wp-block-heading"><strong>2. Google Apps Scriptの設定</strong></h2>



<h3 class="wp-block-heading"><strong>2.1 スタンドアロンApps Scriptの作成</strong></h3>



<p><strong>重要</strong>: スプレッドシートに紐づいたスクリプトではなく、独立したスクリプトを作成します。</p>



<ol class="wp-block-list">
<li><strong>Google Driveで新規作成</strong><strong><br></strong>
<ul class="wp-block-list">
<li>Google Drive → 右クリック → 「その他」→ 「Google Apps Script」</li>



<li>プロジェクト名: MyLibrary</li>
</ul>
</li>



<li><strong>スプレッドシートIDの取得</strong><strong><br></strong>
<ul class="wp-block-list">
<li>作成したスプレッドシートのURLから以下の部分をコピー</li>
</ul>
</li>
</ol>



<pre class="wp-block-code"><code>https://docs.google.com/spreadsheets/d/<strong>【この部分がSPREADSHEET_ID】</strong>/edit#gid=0</code></pre>



<p></p>



<h3 class="wp-block-heading"><strong>2.2 Apps Scriptコードの実装</strong></h3>



<pre class="wp-block-code"><code><br><br>// スプレッドシートIDを使用（より安全）<br>const SPREADSHEET_ID = 'あなたのスプレッドシートID';<br><br>function fetchBookInfo(isbn) {<br>  // デバッグ用：ISBNの値を確認<br>  console.log('fetchBookInfo に渡されたISBN:', isbn);<br>  <br>  const url = `https://www.googleapis.com/books/v1/volumes?country=jp&amp;q=isbn:${isbn}`;<br>  console.log('API URL:', url);<br>  <br>  const res = UrlFetchApp.fetch(url);<br>  const json = JSON.parse(res.getContentText());<br>  <br>  console.log('API レスポンス:', json);<br>  <br>  // エラーハンドリングを追加<br>  if (!json.items || json.items.length === 0) {<br>    throw `ISBN "${isbn}" の書籍情報が見つかりませんでした。totalItems: ${json.totalItems}`;<br>  }<br>  <br>  return json.items&#91;0].volumeInfo;<br>}<br><br>function updateBook(isbn) {<br>  // スプレッドシートIDを使用してスプレッドシートを開く<br>  const sheet = SpreadsheetApp.openById(SPREADSHEET_ID).getSheetByName('Books');<br>  const rowIndex = sheet.getDataRange().getValues().findIndex(row =&gt; row&#91;0] == isbn);<br>  if (rowIndex === -1) throw `ISBNが"${isbn}"の行がありません。`;<br>  <br>  const info = fetchBookInfo(isbn);<br>  <br>  // データが不完全な場合の対応<br>  const row = &#91;<br>    isbn, <br>    info.title || '不明', <br>    info.subtitle || '', <br>    (info.authors || &#91;]).join(', '), <br>    info.publisher || '不明', <br>    info.publishedDate ? new Date(info.publishedDate) : '', <br>    info.description || '', <br>    info.imageLinks ? info.imageLinks.thumbnail : '', <br>    new Date()<br>  ];<br>  sheet.getRange(rowIndex + 1, 1, 1, row.length).setValues(&#91;row]);<br>}<br><br>function testFetchBookInfo() {<br>  // &#x2b50; 重要：ISBNを文字列として指定（引用符で囲む）<br>  console.log(fetchBookInfo('9784295021674'));<br>}<br><br>function testUpdateBook() {<br>  // &#x2b50; 重要：ISBNを文字列として指定（引用符で囲む）<br>  updateBook('9784295021674');<br>}<br><br>// テスト用関数<br>function simpleTest() {<br>  console.log('=== 単純テスト開始 ===');<br>  const testISBN = '9784295021674';<br>  console.log('テスト用ISBN:', testISBN);<br>  <br>  try {<br>    const result = fetchBookInfo(testISBN);<br>    console.log('成功:', result);<br>  } catch (error) {<br>    console.log('エラー:', error);<br>  }<br>}<br></code></pre>



<h3 class="wp-block-heading"><strong>2.3 Apps Scriptのテスト実行</strong></h3>



<ol class="wp-block-list">
<li><strong>testFetchBookInfo() の実行</strong><strong><br></strong>
<ul class="wp-block-list">
<li>実行ログに書籍情報が表示されることを確認</li>
</ul>
</li>



<li><strong>testUpdateBook() の実行</strong><strong><br></strong>
<ul class="wp-block-list">
<li>スプレッドシートのA2行に書籍情報が自動入力されることを確認（私が書いた本が出るはずです！）</li>
</ul>
</li>



<li></li>
</ol>



<h2 class="wp-block-heading"><strong>3. AppSheetアプリの作成</strong></h2>



<h3 class="wp-block-heading"><strong>3.1 AppSheetアプリの初期作成</strong></h3>



<ol class="wp-block-list">
<li><strong>スプレッドシートからアプリ作成</strong>
<ul class="wp-block-list">
<li><strong><span data-color="#fffd6b" style="--vk-highlighter-color: rgba(255, 253, 107, 0.7);" class="vk_highlighter">スプレッドシート</span></strong>上部メニュー「拡張機能」→「AppSheet」→「アプリを作成」</li>



<li>「Customize withAppSheet」ボタンをクリック</li>
</ul>
</li>
</ol>



<h3 class="wp-block-heading"><strong>3.2 Books テーブルのデータ設定</strong></h3>



<p><strong>Data &gt; Books &gt;ViewColumnで以下を設定：</strong><br>(横に長いので、矢印キーでスクロール)1行目に_RowNumberが入っているときがあるが気にしない</p>



<figure class="wp-block-table"><table class="has-fixed-layout"><tbody><tr><td><strong>列名</strong></td><td><strong>TYPE変更</strong></td><td><strong>KEY?</strong></td><td><strong>SCAN?</strong></td><td><strong>REQUIRE?</strong></td><td><strong>INITIAL VALUE</strong></td></tr><tr><td>ISBN</td><td><strong>Text</strong></td><td><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /></td><td></td></tr><tr><td>title</td><td>Text</td><td></td><td></td><td></td><td></td></tr><tr><td>subtitle</td><td>Text</td><td></td><td></td><td></td><td></td></tr><tr><td>authors</td><td>Text</td><td></td><td></td><td></td><td></td></tr><tr><td>publisher</td><td>Text</td><td></td><td></td><td></td><td></td></tr><tr><td>publishedDate</td><td>Date</td><td></td><td></td><td><strong>外す</strong></td><td><strong>空にする</strong></td></tr><tr><td>description</td><td>LongText</td><td></td><td></td><td><strong>外す</strong></td><td></td></tr><tr><td>thumbnail</td><td><strong>Image</strong></td><td></td><td></td><td><strong>外す</strong></td><td></td></tr><tr><td>createdAt</td><td>DateTime</td><td></td><td></td><td><strong>外す</strong></td><td>=NOW()</td></tr></tbody></table></figure>



<p><strong>重要ポイント:</strong></p>



<ul class="wp-block-list">
<li><strong>ISBN列のSCAN?</strong>: 必ずチェック（バーコードスキャン機能に必要）</li>
</ul>



<p><strong>publishedDate,description, thumbnail, createdAt</strong>: REQUIRE? のチェックを外す</p>



<p><strong>ISBNスキャン時の自動書籍情報取得:</strong></p>



<ol class="wp-block-list">
<li><strong>Automationタブに移動</strong><strong><br></strong>
<ul class="wp-block-list">
<li>左ペイン「Automation」→「New bot」</li>



<li>Otherの「Bot name」をクリックし、「Create a new bot」</li>



<li>New botの名前を適当に変える</li>
</ul>
</li>



<li><strong>EVENT設定</strong><strong><br></strong>
<ul class="wp-block-list">
<li>Configure event をクリックし、Create a new event →右側にSettingがでる</li>



<li>Event name: Register（なんでもよい）</li>



<li>Event source:App</li>



<li>Table: Books</li>



<li>Data change type: Adds のみチェック（他は外す）</li>



<li>Condition: 空のまま</li>
</ul>
</li>



<li><strong>PROCESS設定</strong><strong><br></strong>
<ul class="wp-block-list">
<li>「Add a step」→「Create a new step」→Setting</li>



<li>「Call a script」</li>



<li>Apps Script Project: 作成したスタンドアロンApps Script(検索)を選択</li>



<li>Function Name: updateBook(isbn)</li>



<li>Function Parameters: [ISBN]→SAVE</li>
</ul>
</li>
</ol>



<h2 class="wp-block-heading"><strong>4. 表示設定（Views）の調整</strong></h2>



<h3 class="wp-block-heading"><strong>4.1 Books一覧の表示設定</strong></h3>



<p><strong>UX &gt; Books &gt; Booksで以下を設定:</strong></p>



<ol class="wp-block-list">
<li><strong>View type</strong>: deck に変更<br></li>



<li><strong>View Options設定:</strong><strong><br></strong>
<ul class="wp-block-list">
<li>Sort by: 空にする</li>



<li>Main Image: thumbnail</li>



<li>Primary header: title</li>



<li>Secondary header: authors</li>



<li>Summary column: publishedDate</li>
</ul>
</li>
</ol>



<p>AppSheetの画面で、左上の名前を変更するとアプリに反映される</p>



<p>スマホにAppSheetのアプリを入れて、Googleアカウントで入れば見られます。</p>



<p>素敵な蔵書ライフを。</p>The post <a href="https://mamion.net/2025/10/library-catalog-management/">蔵書をスマホでスキャンして管理する</a> first appeared on <a href="https://mamion.net">マミオン有限会社-パソコン・数学研修、法人研修</a>.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
