Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to create a SSE plugin for read Google SpreadSheet.
I can load data but I can't get column name (in first line of my spreadsheet). I have try to use this code
md = (('qlik-tabledescription-bin', table.SerializeToString()),)
context.send_initial_metadata(md)But when I send data to Qlik Sense, only the first row is loaded (but I have hearders).
def _load_spreadsheet(request, context):
for request_rows in request:
spreadSheetId = request_rows.rows[0].duals[0].strData
sheet = request_rows.rows[0].duals[1].strData
result = google_sheet.load_spreadsheet(spreadSheetId, sheet)
table = SSE.TableDescription(name=sheet, numberOfRows=10000)
for col in result[0]:
table.fields.add(name=col, dataType=SSE.DUAL)
md = (('qlik-tabledescription-bin', table.SerializeToString()),)
context.send_initial_metadata(md)
del result[0]
table = []
for result_row in result:
line = []
for item in result_row:
dual = SSE.Dual(strData=item)
line.append(dual)
yield SSE.BundledRows(rows=[SSE.Row(duals=line)])Thanks,
Aurélien
I change this line :
table.fields.add(name=col, dataType=SSE.DUAL)
By
table.fields.add(name=col, dataType=SSE.STRING)
And that work 🙂
I change this line :
table.fields.add(name=col, dataType=SSE.DUAL)
By
table.fields.add(name=col, dataType=SSE.STRING)
And that work 🙂