DriveApp.getFolderById Error encountered

796 views
Skip to first unread message

Abilayne Liz

unread,
Jul 11, 2023, 11:29:04 PM7/11/23
to Google Apps Script Community
Hi all.

Noob question here. I'm getting this error on the getFolderByID. Unsure what's the issue here. I've already modified the name of the folder and removed the underscore or space.
The folder ID is correct.

Screenshot 2023-07-12 112610.png

Thanks in advance for any help

cbmserv...@gmail.com

unread,
Jul 12, 2023, 1:17:04 AM7/12/23
to google-apps-sc...@googlegroups.com

Not sure if this is your actual code or not. But usually a folder Id is a longer sequence of numbers and letters. What you have there as TBCInv is not a folder Id.

 

If you go into that folder on google drive, you will find the id in this space:

 

 https://drive.google.com/drive/folders/575957... ?resourcekey=…

 

the id is after folders/   and before the ?resourcekey=….

 

Just copy that and paste it into your script.

 

Disclosure: I did not check the rest of your script to see if it is correct or not.

 

 

From: google-apps-sc...@googlegroups.com <google-apps-sc...@googlegroups.com> On Behalf Of Abilayne Liz
Sent: Tuesday, July 11, 2023 8:29 PM
To: Google Apps Script Community <google-apps-sc...@googlegroups.com>
Subject: [Apps-Script] DriveApp.getFolderById Error encountered

 

Hi all.

 

Noob question here. I'm getting this error on the getFolderByID. Unsure what's the issue here. I've already modified the name of the folder and removed the underscore or space.

The folder ID is correct.

 

 

Thanks in advance for any help

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/95496c8e-fb32-4f7e-ab9b-3077384ed42dn%40googlegroups.com.

image001.png

Freelancer Techworld

unread,
Jul 12, 2023, 1:26:24 AM7/12/23
to Google Apps Script Community
In your code, you use the folder name "TBCInv" as folderId, it is not correct.

When you open a Drive folder, go to URL bar to get folderId from the URL, for example, the URL is 'https://drive.google.com/drive/folders/abcdefgh...', then your folderId is 'abcdefgh...'

Abilayne Liz

unread,
Jul 12, 2023, 3:09:33 AM7/12/23
to Google Apps Script Community
Hello, I was not aware of this. I changed the folder ID and this totally worked!

Thanks for helping me out.

Reply all
Reply to author
Forward
0 new messages