0

I am trying to connect to the smartsheet api using C#, Visual Studio 2017. I am trying to get the history of a cell in a report so I can graph the changes of the percentage value that is in the cell over time.

I am using <package id="smartsheet-csharp-sdk" version="2.86.0" targetFramework="net461" />

I can successfully do an API call to get the cell history of a sheet with

        try
        {
            SmartsheetClient smartsheet = new SmartsheetBuilder().SetAccessToken(apiToken).Build();
            PaginatedResult<CellHistory> results = smartsheet.SheetResources.RowResources.CellResources.GetCellHistory(
                sheetId,               // long sheetId
                rowId,                 // long rowId
                columnId,              // long columnId
                null,                  // IEnumerable<CellInclusion> includes
                null                   // PaginationParameters
                );

            textBox1.Text = ("Found " + results.TotalCount + " results");

            dataGridView2.Columns.Add("Date", "Date");
            dataGridView2.Columns.Add("Value", "Value");

            for (int i = 0; i < results.TotalCount; i++)
            {
                var index = dataGridView2.Rows.Add();
                dataGridView2.Rows[i].Cells["Date"].Value = (System.DateTime)results.Data[i].ModifiedAt;
                dataGridView2.Rows[i].Cells["Value"].Value = (double)results.Data[i].Value;
            }

        }
        catch (Exception ex)
        {
            textBox1.Text = ex.ToString();
        }

That works fine.

I've tried to use smartsheet.ReportResources but it doesnt have RowRecources then.

If I point the same SheetResources code to a report I get an error

Smartsheet.Api.ResourceNotFoundException: Not Found
   at Smartsheet.Api.Internal.AbstractResources.HandleError(HttpResponse response)
   at Smartsheet.Api.Internal.AbstractResources.ListResourcesWithWrapper[T](String path)
   at Smartsheet.Api.Internal.RowColumnResourcesImpl.GetCellHistory(Int64 sheetId, Int64 rowId, Int64 columnId, IEnumerable`1 include, PaginationParameters paging, Nullable`1 level)
   at Smartsheet.Api.Internal.RowColumnResourcesImpl.GetCellHistory(Int64 sheetId, Int64 rowId, Int64 columnId, IEnumerable`1 include, PaginationParameters paging)

Can someone please give me some assistance as to how to get the history of a cell in a report?

Gillan
  • 149
  • 1
  • 4
  • 11

1 Answers1

1

Currently the API does not provide any suppport for reading/writing reports. I would suggest to build the same kind of report using sheets, sheets references and formulas.

Then you should be able to read these sheets and get their history.