【问题标题】:Google Apps Script: Export Dashboard to CSVGoogle Apps 脚本:将仪表板导出为 CSV
【发布时间】:2016-09-13 18:46:38
【问题描述】:

我创建了一个仪表板,类似于 Google Apps 脚本Help Center 中提供的示例。它包含过滤包含数据的电子表格的控件。我想在仪表板上添加一个选项,允许用户将过滤后的视图导出到新的 CSV 文件或 Google 表格文件,该文件将保存在他们的云端硬盘中,但我不知道如何执行此操作。有什么建议吗?

【问题讨论】:

    标签: charts google-apps-script google-sheets export-to-csv dashboard


    【解决方案1】:

    这是来自 Google 教程的代码 sn-p:

    function saveAsCSV() {
      // Prompts the user for the file name
      var fileName = Browser.inputBox("Save CSV file as (e.g. myCSVFile):");
    
      // Check that the file name entered wasn't empty
      if (fileName.length !== 0) {
        // Add the ".csv" extension to the file name
        fileName = fileName + ".csv";
        // Convert the range data to CSV format
        var csvFile = convertRangeToCsvFile_(fileName);
        // Create a file in the Docs List with the given name and the CSV data
        DocsList.createFile(fileName, csvFile);
      }
      else {
        Browser.msgBox("Error: Please enter a CSV file name.");
      }
    }*
    

    查看full tutorial and code here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-27
      • 1970-01-01
      相关资源
      最近更新 更多