google-sheets-macros

Why doesn't copyTo(… PASTE_VALUES) work in the middle of a macro?

三世轮回 提交于 2019-12-01 13:12:34
One of my longstanding techniques with spreadsheets is Copy / Paste Special Values (C/PSV), in place. Having used formulas to produce the values I'm interested in, I C/PSV and can then delete the source data. So I wrote a macro which uses this technique, but the cells wind up empty. But if I split the macro into two, ending the first macro before C/PSV, then everything works as intended. Why is this? Is there a better way to work around this problem? Here are my three macros. function Step1() { var spreadsheet = SpreadsheetApp.getActive(); var range = spreadsheet.getActiveRange();

How to export google sheet as CSV by selected columns

谁说我不能喝 提交于 2019-12-01 11:43:55
问题 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 picturecolumn, 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

Why doesn't copyTo(… PASTE_VALUES) work in the middle of a macro?

自古美人都是妖i 提交于 2019-12-01 10:44:34
问题 One of my longstanding techniques with spreadsheets is Copy / Paste Special Values (C/PSV), in place. Having used formulas to produce the values I'm interested in, I C/PSV and can then delete the source data. So I wrote a macro which uses this technique, but the cells wind up empty. But if I split the macro into two, ending the first macro before C/PSV, then everything works as intended. Why is this? Is there a better way to work around this problem? Here are my three macros. function Step1()