Example #1
0
def excel():
    """
    Post an excel file and fetch it's configuration
    """
    excel_file = request.files['file']
    sheet = request.values.get('sheet')
    conditional_formatting = False if request.values.get(
        'conditional_formatting') == 'false' else True
    excel = Excel(get_config(),
                  excel_file._file,
                  conditional_formatting=conditional_formatting)
    confluence = Confluence(get_config())
    content = excel.parse(sheet=sheet)
    content['header'] = request.values.get('header')
    content['source'] = confluence.source_from_data(
        content.get('data', {}), header=content.get('header'))
    return json.dumps(content, default=json_serial)