-1

Does anyone know how we can export filtered data from Google App Maker table widget.

My table from the data source (no filter): that show everything

After applying some filter filtered.

I manage to export everything to Google Spreadsheet (see this SO answer), but I am stuck on exporting only the data after applying some filter. Really appreciate if anyone can share the solution. Thanks!

tehhowch
  • 9,645
  • 4
  • 24
  • 42
alep
  • 135
  • 12
  • You tagged this as Apps Script.. I don't see any code that you have tried. What have you tried? – tehhowch Mar 25 '18 at 06:23
  • I manage to export all data from datasource of AppMaker using the Client Script, but now I just want to export filtered data from table. – alep Mar 26 '18 at 01:30

2 Answers2

0

It seems that you are looking for filters. It should work if you modify script from this answer to something similar to this:

// Server script
function dataExport(filter1, filter2, ...) {
  // TODO: Check permissions.
  ...
  var query = app.models.MyModel.newQuery();

  // TODO: Apply user/roles specific filters for
  // security reasons.
  query.filters.Field1._equals = filter1;
  query.filters.Field2._greaterThan = filter2;
  ...
  var filteredRecords = query.run();

  filteredRecords.forEach(function(record) {
    ...
  });
  ...
Pavel Shkleinik
  • 6,298
  • 2
  • 24
  • 36
-1

The AMU Library can do this in one command in a button onClick. The button just needs to be on the same datasource as the table.

Simply:

AMU.export.toSpreadsheet = function(widget, Your_modelName);