スプレッドシートAPI全体を検索して、グーグルで検索していただけで、私はドライブAPIを含めて入札に使う以外に選択肢はありませんでした。ここに私が思いついた解決策があります。これが他の誰かを助けることを願っています! index.html
ファイルにクライアント側JSライブラリをGoogleからこのスクリプトを使用し
:JSのためにその後
<body>
...
<script type="text/javascript" src="https://apis.google.com/js/client.js"></script>
</body>
は詰め:
// Cache the api's into variables.
var sheets = gapi.client.sheets;
var drive = gapi.client.drive;
// 1. CREATE NEW SPREADSHEET
sheets.spreadsheets.create({
properties: {
title: 'new-sheet'
}
}).then(function(newSpreadSheet) {
var id = newSpreadSheet.result.spreadsheetId;
// 2. PUBLISH SPREADSHEAT VIA DRIVE API
drive.revisions.update({
fileId: id,
revisionId: 1
}, {
published: true, // <-- This is where the magic happens!
publishAuto: true
}).then(function() {
// 3. DISPLAY SPREADSHEET ON PAGE VIA IFRAME
var iframe = [
'<iframe ',
'src="https://docs.google.com/spreadsheets/d/',
id,
'/pubhtml?widget=true&headers=false&embedded=true"></iframe>'
].join('');
// We're using jQuery on the page, but you get the idea.
$('#container').html($(iframe));
});
});
感謝を。そうですね、私はもともとOAuthに関する問題を抱えていて、Sheets&Drive APIの両方をうまく使っていました。私がやりたかったことの完全な例をオンラインで見つけることができなかったので、私は結局それを理解しました(下記)。再度、感謝します! –