Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Frustrating File>save as search function in google script

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Frustrating File>save as search function in google script

    Hopefully, this fits in with this thread. I know it is not 100% java, but the functions are similar.

    I am making a lesson plan script that uses a Goolge form to create a report in Google spreadsheet that is identical to the lesson plan template we use at my school. I went through all the tutorials and hundreds of lines of sample code, and I cannot find this answer. Searching for this answer is even more frustrating because it just returns simple directions to save a file from the tool bar!

    In my script, I have a trigger that does the following function on Form sumbission:

    Delete row 2 (this allows the data in row 3 to stay constant with new forms sumbitted)

    Email (email choices are on the form)

    I have the code for this down, and it works fine, (but there is a problem with the 5 minutes delay that Google has in its spreadsheet when it uploads the data to a html. So I have to find a solution that saves the report to the google drive.)


    My focus is to create a sheet (report) and have a script function that automatically saves sheet 2 in google docs.

    When I do a search for google script save function, I get toolbar help.

    This is the only sample script I could find, it runs, but it is not saving what it should and where it should:

     
    function saveAsCSV() {
      // Prompts the user for the file name
      var fileName = Browser.inputBox("Save CSV file as (e.g. myCSVFile):");
     
      // Check that the file name entered wasn't empty
      if (fileName.length !== 0) {
        // Add the ".csv" extension to the file name
        fileName = fileName + ".csv";
        // Convert the range data to CSV format
        var csvFile = convertRangeToCsvFile_(fileName);
        // Create a file in the Docs List with the given name and the CSV data
        DocsList.createFile(fileName, csvFile);
      }
      else {
        Browser.msgBox("Error: Please enter a CSV file name.");}
    }

    Is there a saveAs function that uses a similar syntax to the above in the script I am trying to write?
    If I can find the correct command, this will go much smoother when trying to fix the rest of the script: Saving as a pdf, how to just save sheet 2 which is the report and not the entire spreadsheet).

    Any help would be great,

    Thanks

    -seg
    Last edited by segreto; August 16th, 2012 at 10:31 AM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Frustrating File>save as search function in google script

    Try a javascript forum. This one is for java programming.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Frustrating File>save as search function in google script

    Thread moved from Java theory and questions

Similar Threads

  1. Need help to save Canvas content to a file
    By piulitza in forum AWT / Java Swing
    Replies: 3
    Last Post: December 27th, 2011, 11:20 AM
  2. trying to save data onto a file
    By DanTheSand in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: December 13th, 2011, 09:58 AM
  3. Save form as .pdf file?
    By Taron in forum AWT / Java Swing
    Replies: 3
    Last Post: November 14th, 2010, 02:20 PM
  4. google search
    By nasi in forum Java Theory & Questions
    Replies: 7
    Last Post: April 2nd, 2010, 03:13 AM
  5. Saving .jsp page as .pdf file while generating report for struts based web application
    By ravindra_kumar_tiwari in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: August 12th, 2008, 09:32 AM