def main():
    """ overall function, checks the spreadsheet and outputs the errors """

    workbook = open_workbook(sys.argv[1], on_demand=True)
    errorMessageList_setup = []
    errorMessageList_questions = []
    errorMessageList_choices = []

    print ""

    if not check4correctSheets(workbook, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        return "FATAL ERROR  --  incorrect sheets in workbook"
    print "checking for correct worksheets.......................................OK!"

    # I wonder if it's ok to only have user input questions, and then no choices sheet or a blank one?
    # This definitely has to get checked and parsed before the survey questions can get checked
    if not choicesSheetHasCorrectSetup(workbook, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        return "FATAL ERROR  --  choices could not be parsed"

    choicesDict = parseChoices(workbook, errorMessageList_choices)
    print "checking choices sheet setup..........................................OK!"

    if not surveySheetHasCorrectSetup(workbook, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        return "FATAL ERROR  --  survey could not be parsed"
    questionsList = parseQuestions(workbook)
    print "checking survey sheet setup...........................................OK!"

    checkQuestions(questionsList, errorMessageList_questions)


    # This matters less so I put it below the other two so that they could still get checked if this fails
    if not settingsSheetHasCorrectSetup(workbook, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        return "FATAL ERROR  --  survey could not be parsed"
    print "checking settings sheet setup.........................................N/A"

    print ""

    if len(errorMessageList_choices) > 0:
        for error in errorMessageList_choices:
            print error
            print ""

    if len(errorMessageList_questions) > 0:
        for error in errorMessageList_questions:
            print error
            print ""

    print "Enjoy your survey!....................................................OK!"
    print ""
Example #2
0
def main():
    """ overall function, checks the spreadsheet and outputs the errors """

    workbook = open_workbook(sys.argv[1], on_demand=True)
    errorMessageList_setup = []
    errorMessageList_questions = []
    errorMessageList_choices = []

    print ""

    if not check4correctSheets(workbook, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        return "FATAL ERROR  --  incorrect sheets in workbook"
    print "checking for correct worksheets.......................................OK!"

    # I wonder if it's ok to only have user input questions, and then no choices sheet or a blank one?
    # This definitely has to get checked and parsed before the survey questions can get checked
    if not choicesSheetHasCorrectSetup(workbook, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        return "FATAL ERROR  --  choices could not be parsed"

    choicesDict = parseChoices(workbook, errorMessageList_choices)
    print "checking choices sheet setup..........................................OK!"

    if not surveySheetHasCorrectSetup(workbook, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        return "FATAL ERROR  --  survey could not be parsed"
    questionsList = parseQuestions(workbook)
    print "checking survey sheet setup...........................................OK!"

    checkQuestions(questionsList, errorMessageList_questions)

    # This matters less so I put it below the other two so that they could still get checked if this fails
    if not settingsSheetHasCorrectSetup(workbook, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        return "FATAL ERROR  --  survey could not be parsed"
    print "checking settings sheet setup.........................................N/A"

    print ""

    if len(errorMessageList_choices) > 0:
        for error in errorMessageList_choices:
            print error
            print ""

    if len(errorMessageList_questions) > 0:
        for error in errorMessageList_questions:
            print error
            print ""

    print "Enjoy your survey!....................................................OK!"
    print ""
def main():
    """ overall function, checks the spreadsheet and outputs the errors """

    #workbook = open_workbook(sys.argv[1], on_demand=True)
    data = get_data(sys.argv[1])
    workbookString = json.dumps(data)
    workbookDict = ast.literal_eval(workbookString)

    errorMessageList_setup = []
    errorMessageList_questions = []
    errorMessageList_choices = []

    print ""

    if not check4correctSheets(workbookDict, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        print "FATAL ERROR  --  incorrect sheets in workbook"
        return False
    print "checking for correct worksheets.......................................OK!"

    # I wonder if it's ok to only have user input questions, and then no choices sheet or a blank one?
    # This definitely has to get checked and parsed before the survey questions can get checked
    if not choicesSheetHasCorrectSetup(workbookDict, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        print "FATAL ERROR  --  choices could not be parsed"
        return False

    choicesDict = parseChoices(workbookDict, errorMessageList_choices)
    print "checking choices sheet setup..........................................OK!"

    if not surveySheetHasCorrectSetup(workbookDict, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        print "FATAL ERROR  --  survey could not be parsed"
        return False
    questionsList = parseQuestions(workbookDict, errorMessageList_questions)
########SKETCHY#########
    questionsList = questionsList[:263]
    #print "there are this many questions: "+str(len(questionsList))
#    print questionsList[-3].__dict__
    print "checking survey sheet setup...........................................OK!"

    checkQuestions(questionsList, errorMessageList_questions, choicesDict)


    # This matters less so I put it below the other two so that they could still get checked if this fails
    if not settingsSheetHasCorrectSetup(workbookDict, errorMessageList_setup):
        for error in errorMessageList_setup:
            print error
        print "FATAL ERROR  --  survey could not be parsed"
        return False
    print "checking settings sheet setup.........................................N/A"

    print ""

    if len(errorMessageList_choices) > 0:
        for error in errorMessageList_choices:
            print error
            print ""

    if len(errorMessageList_questions) > 0:
        for error in errorMessageList_questions:
            print error
            print ""

    print "Enjoy your survey!....................................................OK!"
    print ""
    return True