Google-sheets – way to get multiple share links from Google Drive in order

google sheetsgoogle-drivesharing

I have 100s of files on my Google Drive where the files are sorted by name. All I want is the share link of each file in the order they appear in Google Drive.

I tried selecting all these files inside the folder and then click Share but it doesn't respect the order of the files as they are displayed.

How can I do this?

Best Answer

You can do this by writing a script that uses DriveApp to retrieve the names of files and URLs in the folder and sorts the list by filename.

See the listFileInfoBySubFolder script for sample code.