我有一个 AngularJS + C#.NET OnePage 应用程序网站。目标是从我使用 C#(而不是使用 AngularJS)拥有的私有 Google 电子表格中检索 JSON。我阅读了各种 Google Sheets 文档和 API、OAuth 2.0 等,并尝试了一些示例,但它们似乎都不适合我。我看到有不同的方法可以从 Google 电子表格访问和检索数据,但它们仍然不适用于我的情况。谁能帮我?谢谢你。
编辑:我设法通过在 Google Developers Console=>Credentials=>Create Client ID 下创建其他应用程序类型来获得令牌。这是 C# 控制台应用程序:
using System;
using Google.GData.Client;
using Google.GData.Spreadsheets;
namespace MySpreadsheetIntegration
{
class Program
{
static void Main(string[] args)
{
////////////////////////////////////////////////////////////////////////////
// STEP 1: Configure how to perform OAuth 2.0
////////////////////////////////////////////////////////////////////////////
// TODO: Update the following information with that obtained from
// https://code.google.com/apis/console. After registering
// your application, these will be provided for you.
string …Run Code Online (Sandbox Code Playgroud) 检查这个小提琴:JSFiddle
HTML:
<table class="myTable">
<tr>
<th>Some text</th>
<td class="align">
<span class=" someStyle">1</span>/<span class="otherStyle">15</span>
</td>
<th>Some text</th>
<td class="align">
<span class=" someStyle">2</span>/<span class="otherStyle">16</span>
</td>
</tr>
<tr>
<th>Some text</th>
<td class="align">
<span class="">3</span>/<span class="">17</span>
</td>
<th>Some text</th>
<td class="align">
<span class="otherStyle">4</span>/<span class=" someStyle">18</span>
</td>
</tr>
<tr>
<th>Some text</th>
<td class="align">
<span class="otherStyle">5</span>/<span class=" someStyle">19</span>
</td>
<th>Some text</th>
<td class="align">
<span class="">6</span>/<span class="">20</span>
</td>
</tr>
<tr>
<th>Some text</th>
<td class="align">
<span class="">7</span>/<span class="">21</span>
</td>
<th>Some text</th>
<td class="align">
<span class=" someStyle">8</span>/<span class="otherStyle">22</span> …Run Code Online (Sandbox Code Playgroud)