Create Sub Folder in Google Drive

Hi.

I have a question for google drive node.

I want to create a sub folder under an existing folder in google drive.

Can I specify a parent folder when creating a folder in google drive?

Just checked. That is currently not possible. That would have to get programmed first but should not be too complicated.

Did just commit something which should make it possible. Will be released with the next version:
https://github.com/n8n-io/n8n/commit/70db0197e7ed41eb92c21905c62cdc01f339d0ce

I will try it in next version. thanks for your working!

Got released with [email protected].

Thanks. I tried.

I set parent folder id.
But folder was made in Root folder.
Is wrong how to set parent id?

Excuse me @jan

I think the following is correct.

GoogleDrive.node.ts
line 1080

const fileMetadata = {
	name,
	mimeType: 'application/vnd.google-apps.folder',		// -> comma
	parents: options.parents || [],						// -> move here
};

const response = await drive.files.create({
	// @ts-ignore
	resource: fileMetadata,
	fields: queryFields,
	//parents: options.parents || [],					// -> move out
});

please check.

Hello @obana! Welcome to the community.

That makes sense and that was the problem. Did make the change and committed it:
https://github.com/n8n-io/n8n/commit/4d5313849fc25fdf4f7e56ca0a93137a1d6a8498

Thanks a lot for helping out here!

Will release it with the next version.

Got released with [email protected]

@jan Sorry for the late reply.

I confirmed it.
thanks.

1 Like