スプレッドシートの【形式を指定してダウンロード】

682 views
Skip to first unread message

ben bugsy

unread,
Apr 20, 2016, 2:59:42 AM4/20/16
to Google Apps API Japan
お世話になります
なんか教えて君で非常に申し訳ないのですが
他に資料も無く、、、

現在 Googleスプレッドシートで、毎日バックアップを取っています

方法は、googole スプレッドシードのメニュー
[ファイル]-[形式を指定してダウンロード]-[MicrosoftExcel]
を実行しています

これを.netからプログラム実行したいのですが
方法はありますか、おそらく DriveAPIを使えばいいとおもうのですが 
細かい仕様がわからないもので、、
phpその他の言語のでもいいので
ヒントだけでもお願いできればとおもいます

soundTricker

unread,
Apr 20, 2016, 4:48:05 AM4/20/16
to Google Apps API Japan
以下のリンクの「Downloading Google Documents」章の.netのコードを見るとわかると思います。


コード中の
driveService.Files.Export(fileId, "application/pdf");
driveService.Files.Export(fileId, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
にすればexcelとしてダウンロードできるはずです。


2016年4月20日水曜日 15時59分42秒 UTC+9 ben bugsy:

ben bugsy

unread,
Jun 3, 2016, 2:36:24 AM6/3/16
to Google Apps API Japan
soundTricker  遅レスですみません

いただいたページの
> driveService.Files.Export(fileId, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
をヒントに組んでみましたが、一行だけなので甘く見ていましたが
言葉が足りずすみません。実装するのは、vb.netなのですが
vs2013+nugetで、Google Drive API v3をインストールしたところ
driveServiceの下にfiles.exportが無く
にたようなオブジェクトにFileResource.ExportRequest,FileResource.Exportがありますが
うまくいきません


Message has been deleted

ben bugsy

unread,
Jun 3, 2016, 4:37:52 AM6/3/16
to Google Apps API Japan
  さらにいろいろ調べてみて
サンプルページ https://developers.google.com/drive/v3/web/quickstart/dotnet#prerequisites のコードは動きました。
結局のところ
     var service = new DriveService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer = credential,
                    ApplicationName = ApplicationName,
                });
ここをVB.netに変換できれば大きく前進できそうです

ben bugsy

unread,
Jun 7, 2016, 2:46:23 AM6/7/16
to Google Apps API Japan
自己レスです 海外のサイトまで検索したら
ありました

Service = New DriveService(New BaseClientService.Initializer() With {.HttpClientInitializer = MyUserCredential, .ApplicationName = ApplicationName)

これで解決しました。
 
Reply all
Reply to author
Forward
0 new messages