Home>
Contents of question

I created a script to enter the Gdrive storage URL of the file attached to the Google form on the spreadsheet.
Instead of the URL, the error is displayed as "[Ljava.lang.Object;@ 6b18c869".
If anyone has any information about this solution, would you please let me know?

Corresponding source code

var spread_sheet = SpreadsheetApp.openById (Splet Sheet ID)

~~ Omitted ~~

var q5 = [] // Set the attachment array

if (form_items [5] == null) {q5 = "-" // Get "-" if there is no attachment
} else {
var dc = form_items [5] .getResponse ()
for (let i = 0;i var file = DriveApp.getFileById (dc [i])
q5.push (String (file.getUrl ()) + "\ n")} // Store attachments
}

var no = spread_sheet.getSheetByName (sheet name) .getLastRow () // Get the last row of the spreadsheet

spread_sheet.getSheetByName (sheet name) .appendRow (// Fill in the last row of the spreadsheet
[no, q5]
)

Remarks

-If i check the value of q5 in Logger.log (), the correct URL is listed.

  • Answer # 1

    q5I think it's because is an array.

    var spread_sheet = SpreadsheetApp.openById (Splet Sheet ID);
     // ~~ omitted ~~
     var q5 = [];// Set the attachment array
     if (form_items [5] == null) {
    --q5 = "-";// Get "-" if there is no attachment
    + q5 = ["-"];// Get "-" if there is no attachment
     } else {
       var dc = form_items [5] .getResponse ();
       for (let i = 0;i<dc.length;i ++) {
         // Get as many URLs as there are attachments
         var file = DriveApp.getFileById (dc [i]);
         q5.push (String (file.getUrl ()) + "\ n");
       } // Store attachments
     }
     var no = spread_sheet.getSheetByName (sheet name) .getLastRow ();// Get the last row of the spreadsheet
     spread_sheet.getSheetByName (sheet name) .appendRow (
       // Fill in the last line of the spreadsheet
    -[no, q5]
    + [no, ... q5]
     );