Selecting random rows from CSV table

I want to select random rows from the CSV table that i have got from the google spreadsheet.

global Complete data variable contains CSV table from google spreadsheet.

i tried splitting the table by using \n
Please tell me where i am going wrong.

I searched on the community but could not solve my problem.
Please help me.

Once you get data from googlesheet, by using list from table text, it will be converted every row as a list… so you use random integer to select random row from the obtained list. After taking the random list and by using for each items in the list block you can segment each colum into respective variable as a item…

Simple

1 Like

Thank you for the reply.

I did not understand it completely
Are you saying first do this

blocks(11)

Then use this list to select random rows

Yes… but this is not random list

Use one variable to print the random list(row) from this global random list

If you use select list item list (get random list)
Index (random number )- number should start with 1 to length of this random list

1 Like

ok

let me try this

Hello,

i am pretty confused in this logic
i know how to select random items from the list, but i dont know much about csv table.

can you please show me simple blocks of selecting random rows from the csv table

lets say we have to select 20 random rows out of 100 rows in a csv table, and store that in a list

I meant like this, and works well

image

Upon on every click i see randomly selected row**(keep in mind no repetition)** values column data in label1 ,2 and 3 without problem

image

Simple…

Credit to @Taifun for his [Snippets guide]

2 Likes

Thank you for the efforts

But actually my question is different.

Your blocks are absolutely right, I am using this same logic in the next blocks.

I just want to store all those random rows in another list so that i can use that list in the next block.

just use add items to the list… simple

Oh
ya i’ll try that

BTW what is the reason for using this block?
image

Actually it doesnot need i think,

see in my block no where i used it

list from csv table

Parses a text as a CSV (comma-separated value) formatted table to produce a list of rows, each of which is a list of fields.
Rows can be separated by newlines (\n) or CRLF (\r\n).

It is given in the List Documents

no need to use that, just see in my blocks part… may be that could do problem to you


Error: Select list item: Attempt to get item number 1 of a list of length 0: ()

1 Like

Is really needed this part? Are you sure?

But i dont think so?

else share your aia or gsheet structure…

1 Like

Great

I will try to use all same to same blocks.

Thank you for the great efforts

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.