I am using V3 of the google docs api and trying to figure out how to search for a file by name inside a specified folder.
This is what I currently have:
function listFiles(auth) {
const drive = google.drive({version: 'v3', auth});
drive.files.list({
q: 'name = "NAMEHERE" and parents in "FOLDERID"',
pageSize: 10,
fields: 'nextPageToken, files(id, name, webViewLink)',
}, (err, res) => {
if (err) return console.log('The API returned an error: ' + err);
const files = res.data.files;
if (files.length) {
console.log('Files:');
files.map((file) => {
console.log(`${file.name} ${file.webViewLink}`);
});
} else {
console.log('No files found.');
}
});
}