{ "meta": { "version": "4.000.9103", "fileFormatVersion": "0.4", "date": "2024-12-02T22:08:02.594Z", "name": "xls-from-url-to-json-py", "description": "Read xlsx file from URL, convert it to JSON and display it on table", "groupName": "Python", "tags": [ { "text": "DataNodes" }, { "text": "REST-API" }, { "text": "EXCEL" }, { "text": "Widgets" }, { "text": "Table" } ], "schedulerLogOff": true }, "data": { "datanodes": [ { "name": "simpleXls", "type": "REST_web-service_from_datasource", "settings": { "name": "simpleXls", "url": "https://app.xdash.io/public-examples/very-simple.xlsx", "use_xproxy": true, "sampleTime": 0, "autoStart": true, "explicitTrig": false, "req_data_type": "none", "resp_data_type": "binary", "method": "GET", "body": "", "headers": [], "proxyHash": "eyJBZGRyZXNzIjoiaHR0cHM6Ly9hcHAueGRhc2guaW8vcHVibGljLWV4YW1wbGVzL3Zlcnktc2ltcGxlLnhsc3giLCJIb3N0IjoieGRhc2gifQ==", "proxySig": "5TM10MtZYvnW/sf2ZrpNxsx7Jz+k8HgNRDhDWBlJcDHYZzMpS79rsYnIJH3rebDPhA11gAy0mEhudPdNCu5DsZjfZebQTDiJ2HZ+28c14vn4bd9w4Bd5BaORTmT84fSc" } }, { "name": "tab", "type": "Python_plugin", "settings": { "name": "tab", "autoStart": true, "explicitTrig": false, "dockerImage": { "name": "Pyodide", "id": "__PYODIDE__" }, "content": "import pandas as pd\n\ndf_dict = dataNodes[\"xlsxToJson\"]\nheaders = list(df_dict.keys())\ntab = []\n\nfor header in headers:\n tab.append(list(df_dict[header].values()))\n\ntab_of_rows = list(map(list, zip(*tab)))\n\ntab_of_rows.insert(0, headers)\nreturn tab_of_rows" } }, { "name": "xlsxToJson", "type": "Python_plugin", "settings": { "name": "xlsxToJson", "autoStart": true, "explicitTrig": false, "content": "import pandas as pd\nimport base64\nimport io\n\nbuffer = io.BytesIO(base64.b64decode(dataNodes[\"simpleXls\"][\"content\"]))\niso = pd.read_excel(buffer, sheet_name='Feuil1')\n\nreturn iso.to_dict()", "dockerImage": { "name": "Pyodide", "id": "__PYODIDE__" } } } ] }, "libraries": { "pyodideStandard": [ "pandas" ], "pyodideMicropip": [ "openpyxl" ] }, "dashboard": { "flatUiTableA": { "layout": { "top": 27, "left": 25, "height": 501, "width": 698, "z-index": "1" }, "container": { "instanceId": "flatUiTableA", "modelJsonId": "flatUiTable" }, "modelParameters": { "headerLine": true, "indexColumn": false, "tableValueFontSize": 0.5, "striped": true, "valueColor": "var(--widget-table-value-color)", "valueFontFamily": "var(--widget-font-family)", "valueAlign": "left", "bordered": true, "noBorder": false, "editableCols": "[]", "backgroundColor": { "primary": "var(--widget-color-0)", "secondary": "var(--widget-table-striped-odd)" }, "paginationMinNbr": 10, "paginationOptions": "[10, 50, 100, 500]", "paginationDefaultValue": 10, "showWidget": true, "enableWidget": true }, "modelHiddenParams": { "value": null } } }, "connections": { "flatUiTableA": { "value": { "name": "value", "dataNode": "tab", "dataFields": [] } } }, "display": { "theme": "default", "backgroundColor": "var(--widget-color-0)", "inheritThemeBackgroundColor": true, "marginX": 10, "marginY": 10, "width": 1294, "height": 590, "enforceHeightLimit": false }, "navBarNotification": false }