8000 Merge branch 'master' into v66 · Synthoid/ExportSheetData@b829582 · GitHub
[go: up one dir, main page]

Skip to content

Commit b829582

Browse files
committed
Merge branch 'master' into v66
2 parents 472b5e4 + 32c82e2 commit b829582

File tree

5 files changed

+136
-19
lines changed

5 files changed

+136
-19
lines changed

PRIVACYPOLICY.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Privacy Policy
2+
--------------
3+
4+
Starting January 8, 2018, Google will require all apps and add-ons to be verified if they access "sensitive Google APIs." Since [Export Sheet Data](https://workspace.google.com/marketplace/app/export_sheet_data/903838927001) (ESD) must access users' Google Dive files to function, it needs to be verified so users are not shown a terrifying "Unverified App" screen. Part of that verification requires having a visible privacy policy which can be read below.
5+
6+
### When does ESD collect my personal information?
7+
8+
Never. Any personal information collected (which should be none) is purely done by internal Google processes. No personal data collection has been coded into ESD. Your data is YOUR data.
9+
10+
### Where does ESD send my personal information?
11+
12+
Nowhere. Any personal information sent anywhere (which should be nowhere) is purely done by internal Google processes. I have not coded any personal data sharing into ESD. Your data is no one else's business.
13+
14+
### Will ESD ever do anything with my personal information?
15+
16+
Probably not. The only information gathering likely to ever be done by ESD would be analytics to see how many users ESD has and how often it is used. This is not something it currently does, and if it ever is done it would purely be so I could look at pretty graphs when I get bored.
17+
18+
### Why make a privacy policy if you aren't collecting personal information?
19+
20+
Google requires it for verification. I would prefer new users not have to take extra steps to install ESD nor do I want users to feel uneasy because they are installing an "unverified add-on."
21+
22+
### What scopes are used by ESD a 8000 nd why?
23+
24+
The sensitive scopes used by ESD are listed and briefly explained below. A more detailed account of why these scopes are required can be found in the [FAQ](https://github.com/Synthoid/ExportSheetData/blob/master/docs/faq.md) page. You can view official definitions of each scope <a href="https://developers.google.com/identity/protocols/oauth2/scopes" target="_blank">here.</a>
25+
26+
- `https://www.googleapis.com/auth/userinfo.email`
27+
- Scope included in add-ons by default. Allows add-ons to view your email. Not used directly by ESD.
28+
- `https://www.googleapis.com/auth/script.container.ui`
29+
- Scope included in add-ons by default. Allows access to the app's UI.
30+
- `https://www.googleapis.com/auth/drive`
31+
- Allows reading and writing Google Drive files. This is used to create files for the data exported by ESD. Unfortunately there is no way to limit this to only creating or modifying files similar to .read-only scopes so ESD must have authority to read files as well, though it does not actually do so.</li>
32+
- `https://www.googleapis.com/auth/spreadsheets.currentonly`
33+
- Allows access to data contained in the spreadsheets that have installed ESD. This is used to pull data into ESD for export.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Goals
1010

1111
Install
1212
-------
13-
[Install link](https://chrome.google.com/webstore/detail/export-sheet-data/bfdcopkbamihhchdnjghdknibmcnfplk?utm_source=permalink)
13+
[Install link](https://workspace.google.com/marketplace/app/export_sheet_data/903838927001)
1414

1515
Export Sheet Data is available on the Google Workspace Marketplace.
1616

src/ExportSheetData.gs

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ function getFileParentFolderId(file)
368368
**/
369369
function getCellContentArray(cell, separatorChar)
370370
{
371-
var cellArray = [];
371+
let cellArray = [];
372372

373373
//If the cell isn't a string, it's value can't be split into an array.
374374
if(typeof(cell) !== "string")
@@ -377,10 +377,10 @@ function getCellContentArray(cell, separatorChar)
377377
return cellArray;
378378
}
379379

380-
var content = cell;
381-
var commaIndicies = [];
382-
var openQuoteIndicies = [];
383-
var closeQuoteIndicies = [];
380+
let content = cell;
381+
let commaIndicies = [];
382+
let openQuoteIndicies = [];
383+
let closeQuoteIndicies = [];
384384

385385
//Set the indicies for quotes and commas
386386
for(let i=0; i < content.length; i++)
@@ -416,7 +416,7 @@ function getCellContentArray(cell, separatorChar)
416416
}
417417

418418
//Populate the array
419-
var startIndex = 0;
419+
let startIndex = 0;
420420
for(let i=0; i < commaIndicies.length; i++)
421421
{
422422
let arrayString = content.slice(startIndex, commaIndicies[i]);
@@ -445,9 +445,9 @@ function getCellContentArray(cell, separatorChar)
445445
{
446446
if(!isNaN(parseFloat(cellArray[i])))
447447
{
448-
var isNumber = true;
449-
var minusCount = 0;
450-
var decimalCount = 0;
448+
let isNumber = true;
449+
let minusCount = 0;
450+
let decimalCount = 0;
451451

452452
//Parse float is unreliable, so loop through to make sure the string is actually a float
453453
for(let j=0; j < cellArray[i].length; j++)
@@ -490,6 +490,16 @@ function getCellContentArray(cell, separatorChar)
490490
}
491491
else if(cellArray[i] === 'true') cellArray[i] = true;
492492
else if(cellArray[i] === 'false') cellArray[i] = false;
493+
else if(cellArray[i].length > 1)
494+
{
495+
Logger.log(`${cellArray[i]}: ${cellArray[i][0] === '"'} | ${cellArray[i][cellArray[i].length - 1] === '"'}`);
496+
//Strip wrapping quotes...
497+
if(cellArray[i][0] === '"' && cellArray[i][cellArray[i].length - 1] === '"')
498+
{
499+
cellArray[i] = cellArray[i].substring(1, cellArray[i].length - 1);
500+
Logger.log(cellArray[i]);
501+
}
502+
}
493503
}
494504

495505
return cellArray;
@@ -614,7 +624,7 @@ function formatJsonString(value, asObject)
614624
if(value.length > 1)
615625
{
616626
//Get rid of wrapping quotes (")
617-
if(value[0] == '"' && value[value.length-1] == '"')
627+
if(value[0] === '"' && value[value.length-1] === '"')
618628
{
619629
let endValue = value.length - 1;
620630

@@ -623,7 +633,7 @@ function formatJsonString(value, asObject)
623633
value = value.substring(1, endValue);
624634
}
625635
//Don't format object values (wrapped with {})
626-
if(asObject && value[0] == '{' && value[value.length-1] == '}')
636+
if(asObject && value[0] === '{' && value[value.length-1] === '}')
627637
{
628638
//Need to format to match the rest of the file
629639
return value;
@@ -1605,10 +1615,10 @@ function exportSpreadsheetJson(formatSettings, callback)
16051615
{
16061616
if(keyHasPrefix(values[j][0], ignorePrefix)) continue; //Skip rows with the ignore prefix
16071617

1608-
var rowArray = [];
1609-
var rowObject = {};
1610-
var rowIndexNames = []; //Used to keep associations with row indexes correct
1611-
var rowIndexValues = [];
1618+
let rowArray = [];
1619+
let rowObject = {};
1620+
let rowIndexNames = []; //Used to keep associations with row indexes correct
1621+
let rowIndexValues = [];
16121622

16131623
if(!sheetIsValueArray)
16141624
{
@@ -1678,6 +1688,8 @@ function exportSpreadsheetJson(formatSettings, callback)
16781688
content = tryParseJsonArrayString(content);
16791689
}
16801690
}
1691+
1692+
//TODO: Should strip double quotes from content around here... ie ["test, test"] should become [test, test] but only when exporting arrays?
16811693
//We want to export cell arrays, or this column should be exported as an array, so convert the target cell's value to an array of values.
16821694
if(exportArray && (getCellContentArray(content, separatorChar).length > 1) || keyHasPrefix(key, arrayPrefix))
16831695
{
@@ -1721,6 +1733,8 @@ function exportSpreadsheetJson(formatSettings, callback)
17211733
}
17221734
}
17231735

1736+
Logger.log(`12: ${content}`);
1737+
17241738
//Convert the key to a string and strip unneeded prefixes
17251739
if(arrayPrefix != "") key = stripPrefix(key.toString(), arrayPrefix);
17261740
else key = key.toString();
@@ -2062,6 +2076,9 @@ function exportSpreadsheetJson(formatSettings, callback)
20622076

20632077
rowObject[key] = content;
20642078

2079+
Logger.log(JSON.stringify(content));
2080+
Logger.log(`${key}: ${rowObject[key]}`);
2081+
20652082
if(nestedElements) element[key] = content;
20662083
}
20672084
}
@@ -2133,6 +2150,7 @@ function exportSpreadsheetJson(formatSettings, callback)
21332150
}
21342151
else
21352152
{
2153+
Logger.log(JSON.stringify(rowObject));
21362154
sheetJsonObject[values[j][0]] = rowObject;
21372155
}
21382156
}

src/SidebarJavaScript.html

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,70 @@
1919
const JSON_JA_DEFAULT = "JA_";
2020
//Nesting Elements
2121
const NEST_NA_DEFAULT = "NA_";
22+
//Keys
23+
const Keys = {
24+
Export : {
25+
Format : "exportType",
26+
Folder : "exportFolder",
27+
FolderType : "exportFolderType",
28+
Sheets : "exportSheets",
29+
TargetSheets : "targetSheets"
30+
},
31+
General : {
32+
ReplaceFiles : "replaceExistingFiles",
33+
UnwrapSingle : "unwrapSingleRows",
34+
CollapseSingle : "collapseSingleRows",
35+
IgnoreEmpty : "ignoreEmptyCells",
36+
Advanced : {
37+
NestedElements : "nestedElements",
38+
Minify : "minifyData",
39+
IncludeFirstColumn : "includeFirstColumn",
40+
IgnoreWithPrefix : "ignoreColumnsWithPrefix",
41+
IgnorePrefix : "ignorePrefix",
42+
UnwrapWithPrefix : "unwrapSheetsWithPrefix",
43+
UnwrapPrefix : "unwrapPrefix",
44+
CollapseWithPrefix : "collapseSheetsWithPrefix",
45+
CollapsePrefix : "collapsePrefix"
46+
}
47+
},
48+
JSON : {
49+
CellArray : "exportCellArray",
50+
SheetArray : "exportSheetArray",
51+
ValueArray : "exportValueArray",
52+
ForceString : "forceString",
53+
Advanced : {
54+
ContentsAsArray : "exportContentsAsArray",
55+
CellObject : "exportCellObject",
56+
EmptyValueFormat : "emptyValueFormat",
57+
NullValueFormat : "nullValueFormat",
58+
SeparatorChar : "separatorChar",
59+
ForceArray : "forceArray",
60+
ForceArrayPrefix : "forceArrayPrefix",
61+
ForceNestedArray : "forceArrayNest",
62+
ForceNestedArrayPrefix : "forceArrayNestPrefix"
63+
}
64+
},
65+
XML : {
66+
ChildElements : "exportChildElements",
67+
BoolsAsInts : "exportBoolsAsInts",
68+
RootElement : "rootElement",
69+
Advanced : {
70+
NameReplacementChar : "nameReplacementChar",
71+
IncludeDeclaration : "includeDeclaration",
72+
DeclarationVersion : "declarationVersion",
73+
DeclarationEncoding : "declarationEncoding",
74+
DeclarationStandalone : "declarationStandalone",
75+
ForceAttributes : "forceAttributes",
76+
ForceAttributesPrefix : "attributePrefix",
77+
FroceChildElements : "forceChildElements",
78+
ForceChildElementsPrefix : "childElementsPrefix",
79+
FroceInnerText : "forceInnerText",
80+
ForceInnerTextPrefix : "innerTextPrefix",
81+
RootNamespace : "rootNamespace",
82+
Namespaces : "namespaces"
83+
}
84+
}
85+
};
2286

2387
//Visualization
2488
var visualizeData = false;
@@ -147,6 +211,7 @@
147211
**/
148212
function onGetPropertiesFailure(error)
149213
{
214+
//alert("There was an error retrieving user settings. This is most often due to multiple accounts being signed in. Please sign out of all but one account and reload the document.");
150215
google.script.run.openErrorModal("Settings Error",
151216
"There was an error retrieving user settings, so default settings have been loaded. This is most often due to multiple accounts being signed in.",
152217
error.stack);
@@ -206,12 +271,13 @@
206271
collapseSheetsPrefix = settings["collapsePrefix"] != null ? (settings["collapsePrefix"] === "" ? COLLAPSE_SHEET_DEFAULT : settings["collapsePrefix"]) : COLLAPSE_SHEET_DEFAULT;
207272

208273
//JSON
209-
exportContentsAsArrayJson = settings["exportContentsAsArray"] != null ? settings["exportContentsAsArray"] === true : exportContentsAsArrayJson;
210-
exportCellObjectJson = settings["exportCellObject"] != null ? settings["exportCellObject"] === true : exportCellObjectJson;
211274
exportCellArrayJson = settings["exportCellArray"] != null ? settings["exportCellArray"] === true : exportCellArrayJson;
212275
exportSheetArrayJson = settings["exportSheetArray"] != null ? settings["exportSheetArray"] === true : exportSheetArrayJson;
213276
exportValueArrayJson = settings["exportValueArray"] != null ? settings["exportValueArray"] === true : exportValueArrayJson;
214277
forceStringJson = settings["forceString"] != null ? settings["forceString"] === true : forceStringJson;
278+
//Advanced JSON
279+
exportContentsAsArrayJson = settings["exportContentsAsArray"] != null ? settings["exportContentsAsArray"] === true : exportContentsAsArrayJson;
280+
exportCellObjectJson = settings["exportCellObject"] != null ? settings["exportCellObject"] === true : exportCellObjectJson;
215281
emptyValueFormatJson = settings["emptyValueFormat"] != null ? (settings["emptyValueFormat"] === "" ? emptyValueFormatJson : settings["emptyValueFormat"]) : emptyValueFormatJson;
216282
nullValueFormatJson = settings["nullValueFormat"] != null ? (settings["nullValueFormat"] === "" ? nullValueFormatJson : settings["nullValueFormat"]) : nullValueFormatJson;
217283
arraySeparatorCharJson = settings["separatorChar"] != null ? (settings["separatorChar"] === "" ? "," : settings["separatorChar"]) : JSON_SEPARATOR_DEFAULT;

src/SidebarStyle.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
content: '\25ba';
181181
color: white;
182182
float: left;
183-
margin: 16px 0px 0px 10px;
183+
margin: 10px 0px 0px 10px;
184184
font-size: 16px;
185185
}
186186

0 commit comments

Comments
 (0)
0