2008-03-05

How to make an exhibit from data fed directly from a Google Spreadsheet

原文

Google Spreadsheet から直接供給されるデータから exhibit する方法

This tutorial shows you how to feed data directly from a Google Spreadsheet rather than from a file. The advantage of this is that you can edit your data in Google Spreadsheets' user interface. Here is an example.

Formatting the Data

You need to make sure that your Google spreadsheet follows a particular format, which can be seen here:

あなたはあなたの Google スプレッドシートが特定のフォーマットに従うことを確認する必要があります。そして、それはここで見ることができます:

 http://spreadsheets.google.com/pub?key=pLvsUS-CftHo21r-0xjKvVA


The first row contains the property names wrapped in {}. You can specify the value type for a property, e.g., {rating:number}. You can have multiple values for each field and they should be separated by semicolons, e.g., "Drama; Epic". If you want to tell Exhibit not to split a field by semicolons, add ":single" to the column header, e.g., {plot:single}.



最初の行は、{} の中に包まれたプロパティ名を含みます。プロパティの型を定義することも出来ます、例えば、{rating:number}。複数の値を同一フィールドに持つことができ、それらは、セミコロンで区切られます、例えば、"Drama; Epic"。もし、セミコロンでフィールドを分割しないよう Exhibit に指示したい場合は、カラムヘッダーに ":single" を追加してください、例えば、{plot:single}



Important note! Be sure to make the first column {label}. Otherwise Exhibit will use what it finds in cell A1 as {label}, since the Google Spreadsheet export format does not convey the data listed in that cell.



重要な注意! 必ず最初のカラムとして{label}を作って下さい。さもないと、Google スプレッドシートエクスポート形式がそのセルにリストされたデータを伝達しないので、Exhibit は、A1 セルで見つけたものを {label} として使います。



Getting the Feed



First, open your Google spreadsheet and then click on the Publish tab on the right. If it's not published yet, click Publish Now. Then you will see something like this:



まず最初に、あなたの Google スプレッドシートを開き、次に、右の方の Publish タブをクリックしてください。 まだ発行していない場合は、 Publish Now をクリックしてください。 すると、あなたはこのような物を見るでしょう。



 Publish at: http://spreadsheets.google.com/pub?key=pLvsUS-CftHo21r-0xjKvVA


Click on the URL to get a new window with your spreadsheet in view only mode.



URL をクリックすると表示のみモードのスプレッドシートの新しいウィンドウが開きます。



For Firefox


If you're using Firefox, right click anywhere on the page and choose View Page Info. Then click on the Links tab, and look for a row in which Name is "alternate", Type is "Related Item", "Address" looks something like this:



 http://spreadsheets.google.com/feeds/list/o08841867754116283182.6102151849127695926/od6/public/basic


Right click on that row and choose Copy. Then close the dialog box. What you've copied is the URL of the feed of the spreadsheet.



For Internet Explorer


Right click somewhere on the page and choose View Source. Then use the source editor's Find command to search for "feeds". That should land you in the middle of the feed URL. Copy that URL to the clipboard and close the source editor.



Setting up the Exhibit



To link in your data, paste in that feed URL and append ?alt=json-in-script to it. Then, make sure the data link has type="application/jsonp" (note the "p") and ex:converter="googleSpreadsheets":



 <link rel="exhibit/data" 
type="application/jsonp"
href="http://spreadsheets.google.com/feeds/list/o08841867754116283182.6102151849127695926/od6/public/basic?alt=json-in-script"
ex:converter="googleSpreadsheets" />


This is assuming that you are using Exhibit version 2.0.



Re-publishing



You can set your Google Spreadsheet to re-publish every so often, or you have to manually click the Re-publish button in Google Spreadsheets.



But that's it!

0 件のコメント: