Skip to content

Commit 20c5c7a

Browse files
committed
1011997: Need to include new UG section for open-save file from Google Drive
1 parent 427b3a4 commit 20c5c7a

2 files changed

Lines changed: 37 additions & 26 deletions

File tree

Document-Processing/Excel/Spreadsheet/React/Open-Excel-File/from-google-drive.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ Start by following the steps provided in this [link](https://help.syncfusion.com
2121

2222
**Step 3:** Modify the `SpreadsheetController.cs` File in the Web Service Project
2323

24-
1. Create a web service project in .NET Core 3.0 or above. You can refer to this [link](https://www.syncfusion.com/blogs/post/host-spreadsheet-open-and-save-services) for instructions on how to create a web service project.
24+
* Create a web service project in .NET Core 3.0 or above. You can refer to this [link](https://www.syncfusion.com/blogs/post/host-spreadsheet-open-and-save-services) for instructions on how to create a web service project.
2525

26-
2. Open the `SpreadsheetController.cs` file in your web service project.
26+
* Open the `SpreadsheetController.cs` file in your web service project.
2727

28-
3. Import the required namespaces at the top of the file:
28+
* Import the required namespaces at the top of the file:
2929

3030
```csharp
3131

@@ -36,9 +36,9 @@ using Syncfusion.EJ2.Spreadsheet;
3636

3737
```
3838

39-
4. Add the following private fields and constructor parameters to the `SpreadsheetController` class, In the constructor, assign the values from the configuration to the corresponding fields.
39+
* Add the following private fields and constructor parameters to the `SpreadsheetController` class, In the constructor, assign the values from the configuration to the corresponding fields.
4040

41-
```Csharp
41+
```csharp
4242

4343
//variables for storing GDrive folderId, ApplicationName and Service-Accountkey credentials
4444
public readonly string folderId;
@@ -55,9 +55,9 @@ public SpreadsheetController(IConfiguration configuration)
5555

5656
```
5757

58-
5. Create the `OpenExcelFromGoogleDrive()` method to open the document from the Google Drive.
58+
* Create the `OpenExcelFromGoogleDrive()` method to open the document from the Google Drive.
5959

60-
```Csharp
60+
```csharp
6161

6262
[HttpPost]
6363
[Route("OpenExcelFromGoogleDrive")]
@@ -128,19 +128,28 @@ public class FileOptions
128128

129129
```
130130

131-
6. Open the `appsettings.json` file in your web service project, add your Google Drive configuration details.
131+
N> You can also refer to this [GitHub](https://github.com/SyncfusionExamples/syncfusion-react-spreadsheet-google-drive-integration/tree/master) repository for reference.
132132

133-
```Json
133+
* Open the `appsettings.json` file in your web service project, add your Google Drive configuration details.
134+
135+
```json
134136

135137
{
136-
"CredentialPath": "path-to-your-service-account-key.json",
137-
"FolderId": "your-google-drive-folder-id",
138-
"ApplicationName": "YourAppName"
138+
"Logging": {
139+
"LogLevel": {
140+
"Default": "Information",
141+
"Microsoft.AspNetCore": "Warning"
142+
}
143+
},
144+
"AllowedHosts": "*",
145+
"CredentialPath": "path-to-your-service-account-key.json",
146+
"FolderId": "your-google-drive-folder-id",
147+
"ApplicationName": "YourAppName"
139148
}
140149

141150
```
142151

143-
N> Replace **Your Google Drive Folder ID**, **Your Application name**, and **Your Path to the OAuth 2.0 Client IDs json file** with your actual Google drive folder ID , Your name for your application and the path for the JSON file.
152+
N> Replace the **credential path**, **folderId** and **application name** in json file with your actual Google drive folder ID , your name for your application and the path for the JSON file.
144153

145154
**Step 4:** Modify the index File in the Spreadsheet sample to make a fetch call to the server to retrieve and load the Excel file from the Google Drive into the client-side spreadsheet.
146155

@@ -176,4 +185,4 @@ const openFromGoogleDrive = () => {
176185
};
177186
```
178187

179-
N> Install the Google.Apis.Drive.v3 NuGet package must be installed in your application to use the previous code example.
188+
N> The Google.Apis.Drive.v3 NuGet package must be installed in your application to use the previous code example.

Document-Processing/Excel/Spreadsheet/React/Save-Excel-File/to-google-drive.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ Start by following the steps provided in this [link](https://help.syncfusion.com
2121

2222
**Step 3:** Modify the `SpreadsheetController.cs` File in the Web Service Project
2323

24-
1. Create a web service project in .NET Core 3.0 or above. You can refer to this [link](https://www.syncfusion.com/blogs/post/host-spreadsheet-open-and-save-services) for instructions on how to create a web service project.
24+
* Create a web service project in .NET Core 3.0 or above. You can refer to this [link](https://www.syncfusion.com/blogs/post/host-spreadsheet-open-and-save-services) for instructions on how to create a web service project.
2525

26-
2. Open the `SpreadsheetController.cs` file in your web service project.
26+
* Open the `SpreadsheetController.cs` file in your web service project.
2727

28-
3. Import the required namespaces at the top of the file:
28+
* Import the required namespaces at the top of the file:
2929

3030
```csharp
3131

@@ -36,7 +36,7 @@ using Syncfusion.EJ2.Spreadsheet;
3636

3737
```
3838

39-
4. Add the following private fields and constructor parameters to the `SpreadsheetController` class, In the constructor, assign the values from the configuration to the corresponding fields.
39+
* Add the following private fields and constructor parameters to the `SpreadsheetController` class, In the constructor, assign the values from the configuration to the corresponding fields.
4040

4141
```csharp
4242

@@ -57,7 +57,7 @@ public SpreadsheetController(IConfiguration configuration)
5757

5858
N> Note: Change your FolderId, CredentialPath, ApplicationName with your own.
5959

60-
5. Create the `SaveExcelToGoogleDrive()` method to save the document to the Google Drive.
60+
* Create the `SaveExcelToGoogleDrive()` method to save the document to the Google Drive.
6161

6262
```csharp
6363

@@ -139,6 +139,8 @@ public async Task<IActionResult> SaveExcelToGoogleDrive([FromForm] SaveSettings
139139

140140
```
141141

142+
N> You can also refer to this [GitHub](https://github.com/SyncfusionExamples/syncfusion-react-spreadsheet-google-drive-integration/tree/master) repository for reference.
143+
142144
* Open the `appsettings.json` file in your web service project, Add the following lines below the existing `"AllowedHosts"` configuration
143145

144146
```json
@@ -150,17 +152,17 @@ public async Task<IActionResult> SaveExcelToGoogleDrive([FromForm] SaveSettings
150152
}
151153
},
152154
"AllowedHosts": "*",
153-
"FolderId": "Your Google Drive Folder ID",
154-
"CredentialPath": "Your Path to the OAuth 2.0 Client IDs json file",
155-
"ApplicationName": "Your Application name"
155+
"CredentialPath": "path-to-your-service-account-key.json",
156+
"FolderId": "your-google-drive-folder-id",
157+
"ApplicationName": "YourAppName"
156158
}
157159
```
158160

159-
N> Replace **Your Google Drive Folder ID**, **Your Application name**, and **Your Path to the OAuth 2.0 Client IDs json file** with your actual Google drive folder ID , Your name for your application and the path for the JSON file.
161+
N> Replace the **credential path**, **folderId** and **application name** in json file with your actual Google drive folder ID , your name for your application and the path for the JSON file.
160162

161-
**Step 4:** Modify the index file in the Spreadsheet sample to use the [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method to serialize the spreadsheet and send the JSON to the backend.
163+
**Step 4:** Modify the index file in the Spreadsheet sample to save the file as json using the [`saveAsJson`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method and send the JSON to the backend.
162164

163-
```js
165+
```typescript
164166
<button class="e-btn" onClick={saveToGoogleDrive}>
165167
Save to Google Drive
166168
</button>;
@@ -197,4 +199,4 @@ const saveToGoogleDrive = () => {
197199
};
198200
```
199201

200-
N> Install the Google.Apis.Drive.v3 NuGet package must be installed in your application to use the previous code example.
202+
N> The Google.Apis.Drive.v3 NuGet package must be installed in your application to use the previous code example.

0 commit comments

Comments
 (0)