This is from https://webapps.stackexchange.com/questions/88769/get-share-link-of-multiple-files-in-google-drive-to-put-in-spreadsheet.
In a Google Sheet, click on Tools->Script Editor
Add the following function (be sure to change the to the ID needed):
function myFunction() {
var ss=SpreadsheetApp.getActiveSpreadsheet();
var s=ss.getActiveSheet();