-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHelper.gs
More file actions
38 lines (30 loc) · 831 Bytes
/
Helper.gs
File metadata and controls
38 lines (30 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* To get sheets of the current active spreadsheet
* @param spreadsheet Spreadsheet
*/
function CreatNewDocument()
{
var sheet = GetActiveSheet("Metadata");
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var documentname = GetCurrentSpreadSheetName(spreadsheet)
var document=DocumentApp.create(documentname);
var documentid = document.getId();
SetCellValue(sheet,1,1,documentid);
return documentid;
}
/**
* To get sheets of the current active spreadsheet
* @param spreadsheet Spreadsheet
*/
function GetExistingDocument()
{
var sheet = GetActiveSheet("Metadata");
var documentid = GetCellValue(sheet,1,1);
return documentid;
}
function GetDocumentFile()
{
var documentid = GetExistingDocument();
var documentfile = DriveApp.getFileById(documentid);
return documentfile;
}