Replace Link Spreadsheet

How to Create Blockcodes when A Button cliked to replace the "Spreadsheet Link" after we Get the Link Spreadsheet

image

Please explain what you are trying to achieve and how your blocks code will interact with your google apps script? Show relevant blocks/screenshots/script code as necessary.

I trying create a new class when login to the app so i want to create one button to generate new link spreadsheet (new class) and when i get the link that visible in the text box, and then I use the link spreadsheet to replace the Link of spreadsheet in Google app script.

You want to create a new spreadsheet when a user logs in to the app ?

Yes. can you help me to solve this?

This web app will create a new sheet, with 20 rows and 10 columns, in the root of your google drive and return the Name and FileID to the app:

doGet(e) {

//create sheet in root
  if ( e.parameter.func == "sheet" ) {
  return createSheet(e.parameter.name);
  }

function createSheet(name) {
  var newSpreadsheet = SpreadsheetApp.create(name,20,10);
  var output = newSpreadsheet.getName() + "|" + newSpreadsheet.getId();
  return ContentService.createTextOutput(output);
}
}

Blocks

image

You may want to read this:

HOWTO: Create a Google Apps Script Web App bound to a Spreadsheet

why it's not work. i get error 1109. in you that works?

  1. Did you follow the setup parts 5 - 8 in the link I provided - publish/authenticate and sharing settings

  2. Your url (in the button1.click event above) should look something like this:

https://script.google.com/macros/s/AKfycbwQLBxaE0eDd2DiHMFPCmT0h9I1ArtuMVwneufExGQmeBSIEWOj/exec?func=sheet&name=mynewsheet

ok thankyou so musch its works. n after that
how to access the new Spreadsheet by mit app inventor

By url

https://docs.google.com/spreadsheets/d/<FILEID>

Example responseContent = "mynewsheet|1TwitPJS_.......rRbeqXnc"

Is this block code made to be combined with the previous block code on one screen?

why on me not make change anything. the result remains the same as the result of the block codes above

Yes

Please explain what you mean


that's my result. not going to access of spreadsheet

Looks like you have set the label to the Web1.GotText url and not responseContent?

image
the result

image
the blockcodes.

why can not access(view) the sheet of spreadsheet? do you created just for that? just for show the name n url.

I mean How to view the link of spreadsheet

There you go :slight_smile:

how to view the link of spreadsheet?. can you solve it?

before that thanks for your nice tutorial step by step. I enjoy it.

Why not try putting the output of setSheetUrl to a label

Come on....it is not that difficult

yeah. its so easy. n then how to access the link