google-sheets-macros

getOAuthToken returns null when called from Google Sheets

徘徊边缘 提交于 2019-12-11 06:35:58
问题 I'm working on a way to limits some Google Sheets for specific users, with the oAuth specification and AWS API Gateway calls, but i'm facing a problem with the ScriptApp.getOAuthToken() function. When i'm running the code with the Google Apps Script debugger, everything's fine, ScriptApp.getOAuthToken() returns me a token i can pass to my AWS API. The expected result for now is just to recieve the username. But if i try to use my function as a macro in a Google Sheets cell, i have the

Navigation in published Google Sheets

我怕爱的太早我们不能终老 提交于 2019-12-11 06:15:56
问题 I need to publish a report I have in Google Sheets, but since the report is very big, with many sheets and tables, I have hyperlinks set up for easy navigation, that take you to ranges in other sheets. When I publish the sheet, the hyperlinks stop working (they take you to the first sheet in a new browser tab). I also tried with a script to change the pages with a button, but the button is not clickable in the published page. Thanks for any tips you might have. EDIT: I've prepared a test

Group rows using google apps scripts

不想你离开。 提交于 2019-12-08 12:08:24
问题 I am writing code in which a user can automatically generate a template of lesson and sub-topics. Each lesson will have 10 sub-topics. I also need to group the rows lesson-wise and topic-wise. But, I am unable to group the rows lesson-wise and topic-wise. Tried using the macro-recorder, but the code does not work while generating multiple lessons. EDIT: Working code is updated below. function shiftrowgroupdepth() { var spreadsheet = SpreadsheetApp.getActive(); var sheet = spreadsheet

google script error “You do not have permission to call create (line 38, file ”macros“)”

橙三吉。 提交于 2019-12-02 21:43:57
问题 var newSpreadsheet = SpreadsheetApp.create("Spreadsheet to export"); I am running a Google Sheet script and I get the following error message on the above line of code. Any idea how to solve the issue? I am a novice. Error message: You do not have permission to call create (line 38, file "macros") 回答1: You're probably running in a script project that is scoped to only the current document. You can check your current requested scopes in the menu, via File -> project properties -> Scopes .

Scroll all worksheets to last row on open

久未见 提交于 2019-12-02 18:03:26
问题 I've built a spreadsheet that has 7 sheets, each of which is filled with many rows of data. I got tired of manually scrolling down to the last row of each sheet, so I constructed a simple script function to programmatically find and go to a sheet's last row. This function works, for the most part, when run manually. However, when I tried to execute this function with a "From Spreadsheet, On Open" installed event trigger, it doesn't fire properly. Here's the function: function LastRowOnOpen()

google script error “You do not have permission to call create (line 38, file ”macros“)”

风格不统一 提交于 2019-12-02 09:57:45
var newSpreadsheet = SpreadsheetApp.create("Spreadsheet to export"); I am running a Google Sheet script and I get the following error message on the above line of code. Any idea how to solve the issue? I am a novice. Error message: You do not have permission to call create (line 38, file "macros") You're probably running in a script project that is scoped to only the current document. You can check your current requested scopes in the menu, via File -> project properties -> Scopes . Check this list for one like spreadsheets.currentonly . If one like it is there, you have either directly or

Scroll all worksheets to last row on open

只谈情不闲聊 提交于 2019-12-02 09:23:29
I've built a spreadsheet that has 7 sheets, each of which is filled with many rows of data. I got tired of manually scrolling down to the last row of each sheet, so I constructed a simple script function to programmatically find and go to a sheet's last row. This function works, for the most part, when run manually. However, when I tried to execute this function with a "From Spreadsheet, On Open" installed event trigger, it doesn't fire properly. Here's the function: function LastRowOnOpen() { var ss = SpreadsheetApp.getActive(); var sheet = SpreadsheetApp.setActiveSheet(ss.getSheetByName('302

Export a Google Sheet to Google Drive in Excel format with Apps Script

大兔子大兔子 提交于 2019-12-01 14:34:18
I would like to create a backup of my Google Spreadsheet into my Google Drive folder, but as an Excel file. I managed to create a code that create a copy of the gsheet and save it into the folder, but I could not change the code to save it as an Excel file. Could you please help me with it? function makeCopy() { var formattedDate = Utilities.formatDate(new Date(), "CET", "yyyy-MM-dd' 'HH:mm"); var name = "Backup Copy " + formattedDate; var destination = DriveApp.getFolderById("1vFL98cgKdMHLNLSc542pUt4FMRTthUvL"); var file = DriveApp.getFileById("2SqIXLiic6-gjI2KwQ6OIgb-erbl3xqzohRgE06bfj2c")

Export a Google Sheet to Google Drive in Excel format with Apps Script

老子叫甜甜 提交于 2019-12-01 13:47:37
问题 I would like to create a backup of my Google Spreadsheet into my Google Drive folder, but as an Excel file. I managed to create a code that create a copy of the gsheet and save it into the folder, but I could not change the code to save it as an Excel file. Could you please help me with it? function makeCopy() { var formattedDate = Utilities.formatDate(new Date(), "CET", "yyyy-MM-dd' 'HH:mm"); var name = "Backup Copy " + formattedDate; var destination = DriveApp.getFolderById(

How to export google sheet as CSV by selected columns

会有一股神秘感。 提交于 2019-12-01 13:36:32
I have a Google sheet want to export as CSV file. But there are 2 columns in the sheet I don't want to export. For example, in the picture column , I don't want to export column "N" and "P" Here are the Apps Script code I wrote for export function menu() { var ui = SpreadsheetApp.getUi(); var menu = ui.createMenu('Menu'); var item = menu.addItem('PICC', 'picc'); var item2 = menu.addItem('Export to CSV', 'csv'); item.addToUi(); item2.addToUi() }; function onOpen() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var csvMenuEntries = [{name: "Download Primary Time File", functionName: