Question: i am creating an angular table using this example from angular material <https://material.angular.io/components/table/overview> is there anyway to export it in excel or pdf?

Answer: 
You can use [mat-table-exporter](https://www.npmjs.com/package/mat-table-exporter) package to export in excel, csv, json or txt formats. It supports paginated tables too.

Stackblitz demo:
<https://stackblitz.com/edit/mte-demo>
You can use ngx-csv for Angular 7 works fine "<https://www.npmjs.com/package/ngx-csv>."
Get the data from the table with
"this.dataSource.connect().subscribe(data=>this.renderedData=data);" and then use export function.