从Microsoft ONE驱动器中读取excel文件 [英] Read excel file from Microsoft ONE drive

查看:112
本文介绍了从Microsoft ONE驱动器中读取excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有存储在Microsoft One Drive中的Excel文件。我想使用C#Console应用程序阅读Excel Sheet Data。可以读取存储在Microsoft One驱动器中的Excel工作表数据。

我想阅读Excel工作表数据并以Json格式获取它。



我尝试了什么:



我试过下面的代码,但是它是不完整的



private OneDriveFileList GetOneDriveRootListing()

{

var accessToken = GetAccessToken();

string jsonData;



string url = string.Format(@https://apis.live.net/v5.0/me/skydrive?access_token={0}

使用(var client = new WebClient())

{

var result = client.OpenRead(new Uri(url));

var sr = new StreamReader(result);

jsonData = sr.ReadToEnd();

}



FileSystemBase driveInfo = JsonConvert.DeserializeObject< filesystembase>(jsonData);



url = string.Format({0}?access_token {1},driveInfo.Upload_Location, accessT oken);

使用(var client = new WebClient())

{

var result = client.OpenRead(new Uri(url) );

var sr = new StreamReader(result);

jsonData = sr.ReadToEnd();

}



OneDriveFileList rootList = JsonConvert.DeserializeObject< onedrivefilelist>(jsonData);



返回rootList;

}

I have Excel file stored in Microsoft One Drive. I want to read Excel Sheet Data using C# Console application. Is Possible to read Excel Sheet Data Stored in Microsoft One Drive.
I want to read Excel Sheet Data and get it in Json format.

What I have tried:

I have tried below code but it was Incomplete

private OneDriveFileList GetOneDriveRootListing()
{
var accessToken = GetAccessToken();
string jsonData;

string url = string.Format(@"https://apis.live.net/v5.0/me/skydrive?access_token={0}"
using (var client = new WebClient())
{
var result = client.OpenRead(new Uri(url));
var sr = new StreamReader(result);
jsonData = sr.ReadToEnd();
}

FileSystemBase driveInfo = JsonConvert.DeserializeObject<filesystembase>(jsonData);

url = string.Format("{0}?access_token{1}", driveInfo.Upload_Location, accessToken);
using (var client = new WebClient())
{
var result = client.OpenRead(new Uri(url));
var sr = new StreamReader(result);
jsonData = sr.ReadToEnd();
}

OneDriveFileList rootList = JsonConvert.DeserializeObject<onedrivefilelist>(jsonData);

return rootList;
}

推荐答案

您必须使用回复链接来回复评论。理查德指出的是,如果这是你自己的OneDrive,那么你可以直接访问它。

我试过下面的代码,但它是不完整的没有解释你的代码有什么问题。我无法看到您尝试访问Excel电子表格的任何地方。



但是要回答您的问题
You have to use the "Reply" link to reply to comments. What Richard was pointing out is, if this is your own OneDrive then you can access it directly.
"I have tried below code but it was Incomplete" does not to explain what the problem is with your code. I can't see anywhere where you are attempting to access an Excel spreadsheet.

But to answer your question
Quote:

可以读取Microsoft One Drive中存储的Excel工作表数据

Is Possible to read Excel Sheet Data Stored in Microsoft One Drive

是。

以下是您研究的一些启动者:

使用C#访问OneDrive [ ^ ]

Excel电子表格作为JSON [< a href =https://www.google.co.uk/search?safe=strict&source=hp&ei=m7zuW4DCLovSsAeQ5aigBA&q=excel+spreadsheet+json&oq=excel+spreadsheet+in+json&gs_l= PSY-ab.3.1.0i22i30k1l4.1809.7523.0.11297.26.25.0.0.0.0.227.2410.17j7j1.25.0 .... 0 ... 1.1.64.psy-ab..1.25.2401.0..0j35i39k1j0i131k1j0i20i263k1j0i67k1.0.uJ4LtJ8me_g target =_ blanktitle =New Window> ^ ]


这篇关于从Microsoft ONE驱动器中读取excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆