这是我到目前为止所拥有的:
// calls a new service and authenticate
SpreadsheetsService myService = new SpreadsheetsService("MyDownloader");
myService.setUserCredentials(DownloaderSettings.Default.Username,
DownloaderSettings.Default.Password);
// get a list of spreadsheets
SpreadsheetQuery query = new SpreadsheetQuery();
SpreadsheetFeed feed = myService.Query(query);
// download them all
foreach (SpreadsheetEntry entry in feed.Entries)
{
string key = entry.AlternateUri
.Content
.Substring(entry.AlternateUri.Content.IndexOf("?key="));
string dlUrl = "https://docs.google.com/feeds/download/spreadsheets/Export"
+ key
+ "&exportFormat=" + DownloaderSettings.Default.FileFormat
+ "&format=" + DownloaderSettings.Default.FileFormat;
Stream stream = myService.Query(new Uri(dlUrl));
using (FileStream fstream = new FileStream(entry.Title.ToString() + "."
+ DownloaderSettings.Default.FileFormat),
FileMode.Create,
FileAccess.ReadWrite,
FileShare.ReadWrite))
{
stream.CopyTo(fstream);
fstream.Flush();
}
}
我想获取我帐户中所有电子表格的列表并将它们全部下载到xlsx
. 我的帐户中有大约 10 个电子表格。当我点击调试时,它们没有被创建。
编辑
如果有帮助,截图:http: //i.imgur.com/wyPZ5jz.png