Hi all!
For my needs, I found a script that exports a table in Excel.
The script code with export-to-excel button
<script> var tableToExcel = (function() { var uri = 'data:application/vnd.ms-excel;base64,' , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>' , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) } , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) } return function(table, name) { if (!table.nodeType) table = document.getElementById(table) var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML} window.location.href = uri + base64(format(template, ctx)) } })() </script> <input type="button" onclick="tableToExcel('view_290')" value="Export to Excel">
"view_290" - instead, insert ID for your DIV block
But there are some difficulties in its implementation. I'm not a programmer, so I do not know how to achieve a good result.
For example, how to place the script in a Custom Javascript table Builder, and that he worked there?
I have the script works only on the target page, for example, if you place it in the box for instructions.
And that's why it only works if the instructions field is in the Add-form or Edit-form entries (that is, there should be any input field, for example, text). If the embed script in the description field - the script is cut off and nothing happens.
The second problem-need to specify in the script table ID. But in the generated Knack tables only have a class, ID is in the div. So exported not only to table, and all the contents of the DIV block.
Any ideas on this?