Google Script returning error at Line 14 but There is no code at Line 14












0














I am trying to write a scrip that will allow me to create a Google Sheet from an Android application, but my Google Script keeps returning this error.



error



Here is my script



1 var ss = SpreadsheetApp.openByUrl("My SpreadSheet");
2
3 var sheet = ss.getSheetByName('Items'); // be very careful ... it is
4 the sheet name .. so it should match
5
6
7 function doPost(e){
8 var action = e.parameter.action;
9
10 if(action == 'addItem'){
11 return addItem(e);
12
13 }
14 }
15 function addItem(e){
16
17 var date = new Date();
18
19 var id = "Item"+sheet.getLastRow(); // Item1
20
21 var itemName = e.parameter.itemName;
22
23 var brand = e.parameter.brand;
24
25 sheet.appendRow([date,id,itemName,brand]);
26
27 return
ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);
29 }









share|improve this question
























  • Screenshot is missing line numbers. Also provide your code as text
    – TheMaster
    Nov 23 at 12:15










  • @TheMaster okay I did it
    – AliKhanafer
    Nov 23 at 14:19










  • Try adding a another return ... for the else condition at line 14.
    – TheMaster
    Nov 23 at 15:18










  • But what should i return
    – AliKhanafer
    Nov 23 at 15:27










  • I added a return statement that would just say "Hello World" but it's still saying I have a bad value at line 14
    – AliKhanafer
    Nov 23 at 15:49
















0














I am trying to write a scrip that will allow me to create a Google Sheet from an Android application, but my Google Script keeps returning this error.



error



Here is my script



1 var ss = SpreadsheetApp.openByUrl("My SpreadSheet");
2
3 var sheet = ss.getSheetByName('Items'); // be very careful ... it is
4 the sheet name .. so it should match
5
6
7 function doPost(e){
8 var action = e.parameter.action;
9
10 if(action == 'addItem'){
11 return addItem(e);
12
13 }
14 }
15 function addItem(e){
16
17 var date = new Date();
18
19 var id = "Item"+sheet.getLastRow(); // Item1
20
21 var itemName = e.parameter.itemName;
22
23 var brand = e.parameter.brand;
24
25 sheet.appendRow([date,id,itemName,brand]);
26
27 return
ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);
29 }









share|improve this question
























  • Screenshot is missing line numbers. Also provide your code as text
    – TheMaster
    Nov 23 at 12:15










  • @TheMaster okay I did it
    – AliKhanafer
    Nov 23 at 14:19










  • Try adding a another return ... for the else condition at line 14.
    – TheMaster
    Nov 23 at 15:18










  • But what should i return
    – AliKhanafer
    Nov 23 at 15:27










  • I added a return statement that would just say "Hello World" but it's still saying I have a bad value at line 14
    – AliKhanafer
    Nov 23 at 15:49














0












0








0







I am trying to write a scrip that will allow me to create a Google Sheet from an Android application, but my Google Script keeps returning this error.



error



Here is my script



1 var ss = SpreadsheetApp.openByUrl("My SpreadSheet");
2
3 var sheet = ss.getSheetByName('Items'); // be very careful ... it is
4 the sheet name .. so it should match
5
6
7 function doPost(e){
8 var action = e.parameter.action;
9
10 if(action == 'addItem'){
11 return addItem(e);
12
13 }
14 }
15 function addItem(e){
16
17 var date = new Date();
18
19 var id = "Item"+sheet.getLastRow(); // Item1
20
21 var itemName = e.parameter.itemName;
22
23 var brand = e.parameter.brand;
24
25 sheet.appendRow([date,id,itemName,brand]);
26
27 return
ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);
29 }









share|improve this question















I am trying to write a scrip that will allow me to create a Google Sheet from an Android application, but my Google Script keeps returning this error.



error



Here is my script



1 var ss = SpreadsheetApp.openByUrl("My SpreadSheet");
2
3 var sheet = ss.getSheetByName('Items'); // be very careful ... it is
4 the sheet name .. so it should match
5
6
7 function doPost(e){
8 var action = e.parameter.action;
9
10 if(action == 'addItem'){
11 return addItem(e);
12
13 }
14 }
15 function addItem(e){
16
17 var date = new Date();
18
19 var id = "Item"+sheet.getLastRow(); // Item1
20
21 var itemName = e.parameter.itemName;
22
23 var brand = e.parameter.brand;
24
25 sheet.appendRow([date,id,itemName,brand]);
26
27 return
ContentService.createTextOutput("Success").setMimeType(ContentService.MimeType.TEXT);
29 }






android google-apps-script web-applications google-sheets






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 15:12









TheMaster

9,3543731




9,3543731










asked Nov 23 at 5:04









AliKhanafer

112




112












  • Screenshot is missing line numbers. Also provide your code as text
    – TheMaster
    Nov 23 at 12:15










  • @TheMaster okay I did it
    – AliKhanafer
    Nov 23 at 14:19










  • Try adding a another return ... for the else condition at line 14.
    – TheMaster
    Nov 23 at 15:18










  • But what should i return
    – AliKhanafer
    Nov 23 at 15:27










  • I added a return statement that would just say "Hello World" but it's still saying I have a bad value at line 14
    – AliKhanafer
    Nov 23 at 15:49


















  • Screenshot is missing line numbers. Also provide your code as text
    – TheMaster
    Nov 23 at 12:15










  • @TheMaster okay I did it
    – AliKhanafer
    Nov 23 at 14:19










  • Try adding a another return ... for the else condition at line 14.
    – TheMaster
    Nov 23 at 15:18










  • But what should i return
    – AliKhanafer
    Nov 23 at 15:27










  • I added a return statement that would just say "Hello World" but it's still saying I have a bad value at line 14
    – AliKhanafer
    Nov 23 at 15:49
















Screenshot is missing line numbers. Also provide your code as text
– TheMaster
Nov 23 at 12:15




Screenshot is missing line numbers. Also provide your code as text
– TheMaster
Nov 23 at 12:15












@TheMaster okay I did it
– AliKhanafer
Nov 23 at 14:19




@TheMaster okay I did it
– AliKhanafer
Nov 23 at 14:19












Try adding a another return ... for the else condition at line 14.
– TheMaster
Nov 23 at 15:18




Try adding a another return ... for the else condition at line 14.
– TheMaster
Nov 23 at 15:18












But what should i return
– AliKhanafer
Nov 23 at 15:27




But what should i return
– AliKhanafer
Nov 23 at 15:27












I added a return statement that would just say "Hello World" but it's still saying I have a bad value at line 14
– AliKhanafer
Nov 23 at 15:49




I added a return statement that would just say "Hello World" but it's still saying I have a bad value at line 14
– AliKhanafer
Nov 23 at 15:49












1 Answer
1






active

oldest

votes


















1














I was using the Volley 1.0.0 library and it turned out that 1.0.0 is no longer supported so I just had to change versions to the latest Volley version and it worked






share|improve this answer





















    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',
    autoActivateHeartbeat: false,
    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%2f53440899%2fgoogle-script-returning-error-at-line-14-but-there-is-no-code-at-line-14%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I was using the Volley 1.0.0 library and it turned out that 1.0.0 is no longer supported so I just had to change versions to the latest Volley version and it worked






    share|improve this answer


























      1














      I was using the Volley 1.0.0 library and it turned out that 1.0.0 is no longer supported so I just had to change versions to the latest Volley version and it worked






      share|improve this answer
























        1












        1








        1






        I was using the Volley 1.0.0 library and it turned out that 1.0.0 is no longer supported so I just had to change versions to the latest Volley version and it worked






        share|improve this answer












        I was using the Volley 1.0.0 library and it turned out that 1.0.0 is no longer supported so I just had to change versions to the latest Volley version and it worked







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 30 at 0:50









        AliKhanafer

        112




        112






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440899%2fgoogle-script-returning-error-at-line-14-but-there-is-no-code-at-line-14%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

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks