title: Telerik Kendo UI Grid Customizing Excel Export
body: <p>I have a Kendo UI Grid for Angular 2 that may have a lot of data. As a result, I am using an API call that includes a count and putting the data in a paginated grid. When I click on the Export to Excel button, it only returns the data that is shown. I would like to be able to export the entire dataset instead. </p>
  
  <p>I think I am supposed to be using the fetchData method and have included it in the grid as follows:</p>
  
  <pre><code>&lt;kendo-grid-excel fileName="MyExport.xlsx" [fetchData]="allResults"&gt;&lt;/kendo-grid-excel&gt;
  </code></pre>
  
  <p>However, the allResults method must return an ExcelExportData object. My method call to the API returns an observable that is then parsed. I have tried returning the data in the subscribe event, but it gives me a TypeScript error that the method must return a value. If I change the return type to "any", it fails on my call to "this" when getting the filters applied externally.</p>
  
  <p>This is my current fetch method:</p>
  
  <pre><code>allResults(): ExcelExportData {
      if (!this.sort.length) {
          this.sort.push({ field: undefined, dir: undefined });
      }
  
      this.myService.resultsGet(
          this.filters.date,
          ...
          undefined,  // skip
          undefined,  // take
          this.sort[0].field,
          this.sort[0].dir
      ).subscribe(
          (pagedList: any) =&gt; {
              for (let item of pagedList.results) {
                  // manipulate a few things here
              }
              return { data: pagedList.results };
          },
          e =&gt; { console.log(`error: ${e}`); }
      );
  }
  </code></pre>
  
  <p>Is there any way to set this up to make an external API call using angular component filters and returning the data through a subscribe?</p>
  
  <p>Thanks in advance!</p>