Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #19

Merged
merged 6 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Apps.GoogleSheets/Actions/SpreadsheetActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,23 @@ public async Task<ColumnDto> GetColumn(
return new ColumnDto() { Column = result.Select(x => x.First().ToString() ?? string.Empty).ToList() };
}

[Action("Find Sheet Row", Description = "Providing a column address and a value, return row number where said value is located")]
public async Task<int?> FindRow(
[ActionParameter] SpreadsheetFileRequest spreadsheetFileRequest,
[ActionParameter] SheetRequest sheetRequest,
[ActionParameter] FindRowRequest input)
{
var range = await GetUsedRange(spreadsheetFileRequest, sheetRequest);
var maxRowIndex = range.Rows.Count;
var client = new GoogleSheetsClient(InvocationContext.AuthenticationCredentialsProviders);
var result = await GetSheetValues(client,
spreadsheetFileRequest.SpreadSheetId, sheetRequest.SheetName, $"{input.Column}1", $"{input.Column}{maxRowIndex}");
var columnValues = result.Select(x => x.First().ToString() ?? string.Empty).ToList();
var index = columnValues.IndexOf(input.Value);
index = index + 1;
return index == 0 ? null : index;
}

[Action("Download sheet CSV file", Description = "Download CSV file")]
public async Task<FileResponse> DownloadCSV(
[ActionParameter] SpreadsheetFileRequest spreadsheetFileRequest,
Expand Down
2 changes: 1 addition & 1 deletion Apps.GoogleSheets/Apps.GoogleSheets.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<Product>Google Sheets</Product>
<Description>Create and edit online spreadsheets. Get insights together with secure sharing in real-time and from any device</Description>
<Version>1.2.10</Version>
<Version>1.3.1</Version>
<AssemblyName>Apps.GoogleSheets</AssemblyName>
</PropertyGroup>
<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions Apps.GoogleSheets/Models/Requests/FindRowRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Blackbird.Applications.Sdk.Common;

namespace Apps.GoogleSheets.Models.Requests
{
public class FindRowRequest
{
[Display("Column", Description = "Column address (e.g. \"A\", \"B\", \"C\")")]
public string Column { get; set; }

public string Value { get; set; }
}
}