Fetching Data in Google SpreadSheets











up vote
0
down vote

favorite












I have a problem with this reference From this Site Using Google SpreadSheet as Database. the problem is that. the Android Application cannot fetch the data in a google spreadsheet. The Application can successfully run but couldn't find data in the Spreadsheet.



I Already Updated the codes from the android studio because of the old version used codes. I just copy and paste it and change some of it.



Codes Below:



The Script Link to fetch the Data :



https://script.google.com/macros/s/AKfycbwZJCWoQ7dpC5KwyRM9JYsjCjymQUspAfPmniOApD_CSEoc-LdP/exec?id=16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0&sheet=Sheet1



Link of the SpreadSheet :



https://docs.google.com/spreadsheets/d/16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0/edit#gid=0



This is the App Script that Fetches the data:



you can also see the app script codes here : App Script Codes.



    function doGet(request) {
var output = ContentService.createTextOutput(),
data = {},
id = request.parameters.id,
sheet = request.parameters.sheet,
ss = SpreadsheetApp.openById(id);

data.records = readData_(ss, sheet);

var callback = request.parameters.callback;

if (callback === undefined) {
output.setContent(JSON.stringify(data));
} else {
output.setContent(callback + "(" + JSON.stringify(data) + ")");
}
output.setMimeType(ContentService.MimeType.JSON);

return output;
}


function readData_(ss, sheetname, properties) {

if (typeof properties == "undefined") {
properties = getHeaderRow_(ss, sheetname);
properties = properties.map(function(p) { return p.replace(/s+/g, '_'); });
}

var rows = getDataRows_(ss, sheetname),
data = ;

for (var r = 0, l = rows.length; r < l; r++) {
var row = rows[r],
record = {};

for (var p in properties) {
record[properties[p]] = row[p];
}

data.push(record);

}
return data;
}


function getDataRows_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);

return sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getValues();
}


function getHeaderRow_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);

return sh.getRange(1, 1, 1, sh.getLastColumn()).getValues()[0];
}


More Codes From the Link Above or click here for not scrolling back.










share|improve this question
























  • There are restrictions on the kind of data you can send between client and server. Check the section in the documentation on client server communications. For example you can’t send dates.
    – Cooper
    Nov 10 at 21:26










  • If you are truly unable to send dates a possible workaround I can used is taking advantage of googles export links. You can read about it here. stackoverflow.com/questions/33713084/…. If you my your sheet readable to anyone with the link and never share the link its virtually impossible to guess. You can then use the instructions to retrieve part of the sheet. An added bonus is you don't have to waste your quota on retrieving information only setting it.
    – John Thompson
    Nov 10 at 23:42

















up vote
0
down vote

favorite












I have a problem with this reference From this Site Using Google SpreadSheet as Database. the problem is that. the Android Application cannot fetch the data in a google spreadsheet. The Application can successfully run but couldn't find data in the Spreadsheet.



I Already Updated the codes from the android studio because of the old version used codes. I just copy and paste it and change some of it.



Codes Below:



The Script Link to fetch the Data :



https://script.google.com/macros/s/AKfycbwZJCWoQ7dpC5KwyRM9JYsjCjymQUspAfPmniOApD_CSEoc-LdP/exec?id=16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0&sheet=Sheet1



Link of the SpreadSheet :



https://docs.google.com/spreadsheets/d/16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0/edit#gid=0



This is the App Script that Fetches the data:



you can also see the app script codes here : App Script Codes.



    function doGet(request) {
var output = ContentService.createTextOutput(),
data = {},
id = request.parameters.id,
sheet = request.parameters.sheet,
ss = SpreadsheetApp.openById(id);

data.records = readData_(ss, sheet);

var callback = request.parameters.callback;

if (callback === undefined) {
output.setContent(JSON.stringify(data));
} else {
output.setContent(callback + "(" + JSON.stringify(data) + ")");
}
output.setMimeType(ContentService.MimeType.JSON);

return output;
}


function readData_(ss, sheetname, properties) {

if (typeof properties == "undefined") {
properties = getHeaderRow_(ss, sheetname);
properties = properties.map(function(p) { return p.replace(/s+/g, '_'); });
}

var rows = getDataRows_(ss, sheetname),
data = ;

for (var r = 0, l = rows.length; r < l; r++) {
var row = rows[r],
record = {};

for (var p in properties) {
record[properties[p]] = row[p];
}

data.push(record);

}
return data;
}


function getDataRows_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);

return sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getValues();
}


function getHeaderRow_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);

return sh.getRange(1, 1, 1, sh.getLastColumn()).getValues()[0];
}


More Codes From the Link Above or click here for not scrolling back.










share|improve this question
























  • There are restrictions on the kind of data you can send between client and server. Check the section in the documentation on client server communications. For example you can’t send dates.
    – Cooper
    Nov 10 at 21:26










  • If you are truly unable to send dates a possible workaround I can used is taking advantage of googles export links. You can read about it here. stackoverflow.com/questions/33713084/…. If you my your sheet readable to anyone with the link and never share the link its virtually impossible to guess. You can then use the instructions to retrieve part of the sheet. An added bonus is you don't have to waste your quota on retrieving information only setting it.
    – John Thompson
    Nov 10 at 23:42















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a problem with this reference From this Site Using Google SpreadSheet as Database. the problem is that. the Android Application cannot fetch the data in a google spreadsheet. The Application can successfully run but couldn't find data in the Spreadsheet.



I Already Updated the codes from the android studio because of the old version used codes. I just copy and paste it and change some of it.



Codes Below:



The Script Link to fetch the Data :



https://script.google.com/macros/s/AKfycbwZJCWoQ7dpC5KwyRM9JYsjCjymQUspAfPmniOApD_CSEoc-LdP/exec?id=16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0&sheet=Sheet1



Link of the SpreadSheet :



https://docs.google.com/spreadsheets/d/16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0/edit#gid=0



This is the App Script that Fetches the data:



you can also see the app script codes here : App Script Codes.



    function doGet(request) {
var output = ContentService.createTextOutput(),
data = {},
id = request.parameters.id,
sheet = request.parameters.sheet,
ss = SpreadsheetApp.openById(id);

data.records = readData_(ss, sheet);

var callback = request.parameters.callback;

if (callback === undefined) {
output.setContent(JSON.stringify(data));
} else {
output.setContent(callback + "(" + JSON.stringify(data) + ")");
}
output.setMimeType(ContentService.MimeType.JSON);

return output;
}


function readData_(ss, sheetname, properties) {

if (typeof properties == "undefined") {
properties = getHeaderRow_(ss, sheetname);
properties = properties.map(function(p) { return p.replace(/s+/g, '_'); });
}

var rows = getDataRows_(ss, sheetname),
data = ;

for (var r = 0, l = rows.length; r < l; r++) {
var row = rows[r],
record = {};

for (var p in properties) {
record[properties[p]] = row[p];
}

data.push(record);

}
return data;
}


function getDataRows_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);

return sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getValues();
}


function getHeaderRow_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);

return sh.getRange(1, 1, 1, sh.getLastColumn()).getValues()[0];
}


More Codes From the Link Above or click here for not scrolling back.










share|improve this question















I have a problem with this reference From this Site Using Google SpreadSheet as Database. the problem is that. the Android Application cannot fetch the data in a google spreadsheet. The Application can successfully run but couldn't find data in the Spreadsheet.



I Already Updated the codes from the android studio because of the old version used codes. I just copy and paste it and change some of it.



Codes Below:



The Script Link to fetch the Data :



https://script.google.com/macros/s/AKfycbwZJCWoQ7dpC5KwyRM9JYsjCjymQUspAfPmniOApD_CSEoc-LdP/exec?id=16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0&sheet=Sheet1



Link of the SpreadSheet :



https://docs.google.com/spreadsheets/d/16O_OfgKxASgqa2WWQKePJI1jnJMTdb4OyXbUJU6kWH0/edit#gid=0



This is the App Script that Fetches the data:



you can also see the app script codes here : App Script Codes.



    function doGet(request) {
var output = ContentService.createTextOutput(),
data = {},
id = request.parameters.id,
sheet = request.parameters.sheet,
ss = SpreadsheetApp.openById(id);

data.records = readData_(ss, sheet);

var callback = request.parameters.callback;

if (callback === undefined) {
output.setContent(JSON.stringify(data));
} else {
output.setContent(callback + "(" + JSON.stringify(data) + ")");
}
output.setMimeType(ContentService.MimeType.JSON);

return output;
}


function readData_(ss, sheetname, properties) {

if (typeof properties == "undefined") {
properties = getHeaderRow_(ss, sheetname);
properties = properties.map(function(p) { return p.replace(/s+/g, '_'); });
}

var rows = getDataRows_(ss, sheetname),
data = ;

for (var r = 0, l = rows.length; r < l; r++) {
var row = rows[r],
record = {};

for (var p in properties) {
record[properties[p]] = row[p];
}

data.push(record);

}
return data;
}


function getDataRows_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);

return sh.getRange(2, 1, sh.getLastRow() - 1, sh.getLastColumn()).getValues();
}


function getHeaderRow_(ss, sheetname) {
var sh = ss.getSheetByName(sheetname);

return sh.getRange(1, 1, 1, sh.getLastColumn()).getValues()[0];
}


More Codes From the Link Above or click here for not scrolling back.







android google-apps-script google-sheets






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 18:27









Kling Klang

32k156286




32k156286










asked Nov 10 at 15:50









RJ Berin

64




64












  • There are restrictions on the kind of data you can send between client and server. Check the section in the documentation on client server communications. For example you can’t send dates.
    – Cooper
    Nov 10 at 21:26










  • If you are truly unable to send dates a possible workaround I can used is taking advantage of googles export links. You can read about it here. stackoverflow.com/questions/33713084/…. If you my your sheet readable to anyone with the link and never share the link its virtually impossible to guess. You can then use the instructions to retrieve part of the sheet. An added bonus is you don't have to waste your quota on retrieving information only setting it.
    – John Thompson
    Nov 10 at 23:42




















  • There are restrictions on the kind of data you can send between client and server. Check the section in the documentation on client server communications. For example you can’t send dates.
    – Cooper
    Nov 10 at 21:26










  • If you are truly unable to send dates a possible workaround I can used is taking advantage of googles export links. You can read about it here. stackoverflow.com/questions/33713084/…. If you my your sheet readable to anyone with the link and never share the link its virtually impossible to guess. You can then use the instructions to retrieve part of the sheet. An added bonus is you don't have to waste your quota on retrieving information only setting it.
    – John Thompson
    Nov 10 at 23:42


















There are restrictions on the kind of data you can send between client and server. Check the section in the documentation on client server communications. For example you can’t send dates.
– Cooper
Nov 10 at 21:26




There are restrictions on the kind of data you can send between client and server. Check the section in the documentation on client server communications. For example you can’t send dates.
– Cooper
Nov 10 at 21:26












If you are truly unable to send dates a possible workaround I can used is taking advantage of googles export links. You can read about it here. stackoverflow.com/questions/33713084/…. If you my your sheet readable to anyone with the link and never share the link its virtually impossible to guess. You can then use the instructions to retrieve part of the sheet. An added bonus is you don't have to waste your quota on retrieving information only setting it.
– John Thompson
Nov 10 at 23:42






If you are truly unable to send dates a possible workaround I can used is taking advantage of googles export links. You can read about it here. stackoverflow.com/questions/33713084/…. If you my your sheet readable to anyone with the link and never share the link its virtually impossible to guess. You can then use the instructions to retrieve part of the sheet. An added bonus is you don't have to waste your quota on retrieving information only setting it.
– John Thompson
Nov 10 at 23:42



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240630%2ffetching-data-in-google-spreadsheets%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240630%2ffetching-data-in-google-spreadsheets%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma