Blocks structure with Big Data

Hello All,

Hope you are doing well.

I had been using app inventor for sometime.

Most of the time I post data to google sheet.

And when creating the blocks to post data like below.

For small amount of data its good. As projects evolve, the amount of data also evolves too.

If I have 40 values to send = 40 tags + 40 values equaling 80 blocks connected to the join block.

Is there a way to structure the blocks in a way that we can send the data one shot where we will not need to create a join block with 80 blocks?

Send a list

To be more precise,

I intend to send the data in the form where the 2 first entry will be static during the post and the 2 second part will be dynamic.

As per code below:

var name = e.parameter.name
var age = e.parameter.age

var P1 = e.parameter.P1 ;
var F1 = e.parameter.F1 ;

var P2 = e.parameter.P2 ;
var F2 = e.parameter.F2 ;


if(name)sheet.appendRow([name,age,P1,F1]);
if(name)sheet.appendRow([name,age,P2,F2]);

Expected result

name age P F
Doe, John 25 horse tools
Doe, John 25 hammer animal

The way that you shared is very helpful but will allow me to only append the whole row.

In terms of blocks, how can I post data in one shot where it will pass through the app script to get the expected result?

Your requirements appear to have changed?

If you want to upload several records at once see here for one way of doing it (use the first method):

Hello @TIMAI2 , thanks for your response.

My requirements did not changed :wink: .

I need to POST data from the app to the google.

But I have a lot of data to input manually in the app. (not csv or any file of files)

As mentioned, If I have 40 values (textbox) to send = 40 tags + 40 values equaling 80 blocks connected to one join block.

The aim is to send all the 40 values in one shot with the expected result as shown below :

where the first 2 columns will appear in all rows.

Note: The first 2 columns is also from the app.

name age P F
Doe, John 25 1 2
Doe, John 25 3 4
Doe, John 25 5 6
Doe, John 25 7 8

OK. You could try something like this:

BLOCKS

SCRIPT

function doPost(e) {

var data = JSON.parse(e.postData.contents) ;
var ss = SpreadsheetApp.getActive(); //assumes script bound to spreadsheet
var sh = ss.getSheetByName('Sheet1');

for (var i=0;i<data.length;i++) {
sh.appendRow(data[i]);
}
return ContentService.createTextOutput("Success") ;
}

SCREENS

image

AIA
GenerateListForSheet.aia (3.0 KB)

Thank you very much @TIMAI2

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