Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Qlik Sense SSE Python - send_initial_metadata

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

 

 

Help users find answers! Don't forget to mark a solution that worked for you!
Labels (2)
1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II
Author

I change this line :

 

                table.fields.add(name=col, dataType=SSE.DUAL)

By 

                table.fields.add(name=col, dataType=SSE.STRING)

And that work 🙂

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

1 Reply
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II
Author

I change this line :

 

                table.fields.add(name=col, dataType=SSE.DUAL)

By 

                table.fields.add(name=col, dataType=SSE.STRING)

And that work 🙂

Help users find answers! Don't forget to mark a solution that worked for you!