Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

393
Views
Create file inside a Folder on Google Drive

I am very new to javascript and automating in google. I am trying to create a doc called Promo Text inside a folder I have just created.

I am able to create 2 sub folders inside the newFolder as well as return the URL to the sheet but, although the Google Apps Script editor gives the option of .createFile, I get the error of

Exception: The parameters (String) don't match the method signature for DriveApp.Folder.createFile. (line 23, file "Code")

Line 23 is const promoText = newFolder.createFile(`${row[1]} Promo Text`,)

If anyone can point me in the right direction I would really appreciate it. Cheers.

function createReleaseFolder() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Schedule');
  const rows = sheet.getDataRange().getValues();
  
    rows.forEach(function(row, index) {
    if (index === 0) return;
    if (row[18]) return;
    if (row[0] === 'DJ'){
  
    const releasesFolder = DriveApp.getFolderById("1OKZEdZxu8BCgJFv4H7pcRGMNjc")
    const newFolder = releasesFolder.createFolder(`${row[1]} ${row[2]} - ${row[3]}`,)
    const audioMasters = newFolder.createFolder("Audio Masters")
    const assets = newFolder.createFolder("Assets")
    const promoText = newFolder.createFile(`${row[1]} Promo Text`,)
    
    const url = newFolder.getUrl();
    sheet.getRange(index + 1, 19).setValue(url)
    }

    })}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try this:

function lfunko() {
  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Schedule');
  const rows = sheet.getDataRange().getValues();
  const releasesFolder = DriveApp.getFolderById("1OKZEdZxu8BCgJFv4H7pcRGMNjc")
  rows.forEach(function (row, index) {
    if (index === 0) return;
    if (row[18]) return;
    if (row[0] === 'DJ') {
      let newFolder = releasesFolder.createFolder(`${row[1]} ${row[2]} - ${row[3]}`);
      newFolder.createFolder("Audio Masters");
      newFolder.createFolder("Assets");
      newFolder.createFile(`${row[1]} Promo Text`,"This is the content");//last change
      sheet.getRange(index + 1, 19).setValue(newFolder.getUrl());
    }
  });
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!