English 中文(简体)
• 如何用黄色表格中的显示器重新命名上载文件
原标题:How to rename a file on upload using submission strings in google forms

这是记录非营利性住房开支的基本理论。 形式和目标领域列于下文。 我试图这样做,以便在提交材料时,将上载的档案从表格本身改用田地。 我想使用的田地是日期pi,两处是缩小面积的,一个包括数量在内的短处。 如今,google在结尾处用“上载名称”来重新命名档案。 我也想删除这一点。

我找到了一些答案,可以追溯地重新命名所有上载体触发器,但不会自动这样做。

外地细节

  • submissionDate - a datepicker
  • personName - Dropdown of names
  • expenseType - Dropdown with strings like food, supplies, and so forth
  • expenseAmount - Number, usually in ##.## form.

目标档案名称:提交文件

非常感谢你们的帮助!

这是不完整的,我不知道有正确的途径去找田。

function onFormSubmit(e) {
    var form=FormApp.getActiveForm();
    // returns the total number of form submissions
    var length=form.getResponses().length;
    //replace QUESTION NUMBER through the index of the question prompting the file upload - keep in mind that the first question has the index 0
    var id=form.getResponses()[length-1].getItemResponses()[QUESTION NUMBER].getResponse();
    //getResponses()[length-1] retrieves the last form response, accounting for the fact that the first index is zero and hte last length-1
    var file=DriveApp.getFileById(id);
    // store filename in variable
    name = file.getName();
    //Removes the built in Name added by google
    var originalname = name.split(  -  )[0]
    // !! Missing, get responses from specific fields, including converting date picker into yyyymmdd format
    var newname = datefield+namefield+typefield+originalname
    file.setName(name);
}

example电子表格 增加了两栏,显示原始档案名称和我想要改名的,这只字不须在纸面上显示,只是改在角角上。

问题回答




相关问题
How to use year counter google app script?

I need an urgent help i have data as follows in a google sheet i need to add a year counter to the column d as follows using google apps script

Google Spreadsheet multiple column filter using OR

I have a Google Spreadsheet with 3 columns that are either blank or have a value. I want to get the count of the number of rows that has A and either B or C populated. If I were writing a SQL query ...

Run Google Apps Script on Google-Spreadsheet event?

If I create a Google apps script, can I hook it up to Google spreadsheet to run based on an event, or must I manually invoke it? I don t know if Google Sheets supports any events. For example: a ...

How do I insert a row in to a Google spreadsheet using c#

I ve seen; Accessing Google Spreadsheets with C# using Google Data API and http://code.google.com/apis/spreadsheets/data/2.0/developers_guide_dotnet.html#CreatingRows However i m still having ...

using Zend_Gdata_Spreadsheets for public spreadsheets?

I have this code which is working, to load a Google Spreadsheet and load some data from it. If the spreadsheet in question is public, how do i modify the code to not require a username/password? $key=...

Programatically updating a Google spreadsheet

I ve got a pre-existing Google spreadsheet. Each month I update this document. I ve got a template workseet in the spreadseet that I d like to clone and then update. I d prefer to clone the ...

热门标签