Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How load a specific sheet from a Spreadsheet

I have a Spreadsheet that contains a lot of sheets, and I need to load one of these sheets, how can I do that?

Here is a photo of the sheets in my Spreadsheet sheets

Here is my idea how to do it:

var sheet = SpreadsheetApp.openById(index).getSheetByName('Geração de Demanda');

Should that be working?

like image 472
Renan Otero Avatar asked Jan 03 '13 20:01

Renan Otero


People also ask

How do you import a sheet from another Excel file?

On the Window menu, click the workbook that contains the sheet that you want to move. Click the sheet that you want to copy to the other workbook. On the Edit menu, click Sheet > Move or Copy Sheet. On the To book menu, click the workbook that you want to move the sheet to.

Can you link to a specific sheet in Excel?

On a worksheet, select the cell where you want to create a link. On the Insert tab, select Hyperlink. You can also right-click the cell and then select Hyperlink... on the shortcut menu, or you can press Ctrl+K. Under Display Text:, type the text that you want to use to represent the link.


1 Answers

You're almost there... what you want is to make that sheet 'active' so try this :

var sheet = SpreadsheetApp.getActiveSpreadsheet();
SpreadsheetApp.setActiveSheet(sheet.getSheetByName('Geração de Demanda'))
like image 58
Serge insas Avatar answered Sep 20 '22 13:09

Serge insas