Discussions

Expand all | Collapse all

When I download a spreadsheet from a report, can I include the Report's name in the title of the .csv so I can trace it?

  • 1.  When I download a spreadsheet from a report, can I include the Report's name in the title of the .csv so I can trace it?

    Posted 04-05-2018 17:25


  • 2.  RE: When I download a spreadsheet from a report, can I include the Report's name in the title of the .csv so I can trace it?

    Top
    Contributor
    Posted 04-05-2018 18:15
    You can use script to download a file or blob of data and force its name. See the attached screenshot where I download all the records in the formula function reference and give it a name myreport.csv:




    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=651

    So all you have to do is bind this script to a button and arrange to pass the name you want for the file.


  • 3.  RE: When I download a spreadsheet from a report, can I include the Report's name in the title of the .csv so I can trace it?

    Posted 08-29-2018 19:54
    Dan, I was able to implement this solution exactly as you presented it and it works great!  However, I would like to create a CSV in this manner without the column headers.  Is that something that is easily done?


  • 4.  RE: When I download a spreadsheet from a report, can I include the Report's name in the title of the .csv so I can trace it?

    Top
    Contributor
    Posted 08-29-2018 20:24
    The variable csv is just a string with newlines separating each row.

    This will probably work:
        var csv2 = csv.split('\n').slice(1).join('\n');
        download("myuniquefile.csv", csv2);
    Very simple console test:
    csv="a,b\n1,2\n3,4"
    "a,b
    1,2
    3,4"
    csv.split('\n').slice(1).join('\n');
    "1,2
    3,4"




  • 5.  RE: When I download a spreadsheet from a report, can I include the Report's name in the title of the .csv so I can trace it?

    Posted 08-29-2018 21:08
    Perfect!  That is exactly what I needed.  Thanks!


  • 6.  RE: When I download a spreadsheet from a report, can I include the Report's name in the title of the .csv so I can trace it?

    Posted 02-20-2019 22:01
    Dan, is it possible to implement this in such a way that two separate files are created with the click of one button?


  • 7.  RE: When I download a spreadsheet from a report, can I include the Report's name in the title of the .csv so I can trace it?

    Bronze
    Contributor
    Posted 02-21-2019 15:34
    Absolutely, you would just need to set a different file name and rerun the CSV creation code like so:

    $.get("https://login.quickbase.com/db/6ewwzuuj?a=q&qid=1&opts=csv")
      .then(function(csv) {
        download("myuniquefile.csv", csv);
      });

    $.get("https://login.quickbase.com/db/<SecondDBID if from a different table>?a=q&qid=<second Query ID>&opts=csv")
      .then(function(csv) {
        download("myuniquefile2.csv", csv);
      });

    The HTTPS: link would have to link to the second report you wanted.