I am working on a JXA script that will be used to copy tables from an existing Numbers sheet, and then paste them into a newly created sheet (in the same document) before making some modifications to individual cell values. I have most of what I need working, but have been unable to figure out how to change the active sheet from the source sheet to the destination sheet (or any sheet).
I have tried the following;
Numbers.documents[0].sheets.byName({name: currentSheet}).activate
It seems to execute (there are no errors), but nothing happens in Numbers. The active sheet does not change. I have the script working in AppleScript using
set active sheet to sheet currentSheet
Any help is appreciated.
I hope this help.
var numbersApp = Application("Numbers");
var docNumbers = numbersApp.documents[0]
// First sheet
docNumbers.activeSheet.set(docNumbers.sheets[0])
// Using sheet name
docNumbers.activeSheet.set(docNumbers.sheets["sheetName"])
Related
I am using the IMPORTRANGE function in Google sheets to draw data from different tabs.
I have made copies of the original sheet, and those copies are circulated among people who can independently make changes and updated their data.
But the IMPORTRANGE function in every copied sheet contains the url link of tabs that are in the original sheet. So when the people are making changes in their copied sheets, their changes aren't reflected in their versions.
But the changes in the original sheet are reflecting in every copied sheet since all of them contain the url link of the original sheet.
Is there any way I can make this dynamic so that the url would always be that of the sheet they are using?
It would take a lot to change every url link, since there are several copies.
Any suggestion would be appreciated.
Thanks in advance!
I have put the url link in individual cells and tried to put cell references in place of the url.
Like this:
=IMPORTANGE("A1","Sheet1!B1:B")
I have some formula that I want to write in App Script because I need to populate the functions. The problem is I can't figure out what formula can make it editable in the sheet because some can't be automated and needs to be manually inputted in the sheet. For example I am using a list of percentages for index match but there are times that the percentage is different from what it should be based on the list, so I need to input it manually. Would there be any way to do it?
I have a sheet with raw data, let's call it "raw". I want to filter data based on the content in 1 cell and move the data in another sheet with a name "data". Basically, if one cell in the "raw" sheet says "yes" I want to move another cell's content to the "data" sheet.
Appreciate your help as I totally messed up :)
Try to include a demo sheet and the things you have tried to make it easier for people to help you.
=FILTER(raw!A1:G, raw!B1:B="yes")
This should work for what you want, change the B column to the column you have "yes" in and change the A1:G to the data you want to be returned.
or:
=QUERY(raw!A:B; "where B = 'yes'"; 0)
I've been working around with the CKEditor 5 with:
var mySelection = editor.getSelection();
to get selected text and being able to save it to a database for example.
I wanted to know if there is an easier way to save selected text to a database and then after recovering the text a way to set it as selected automatically in the editor window.
An easy way to save selection and set selection again in the same text.
Is there a plugin or something similar?
Regards
This is the way to get stuff that is selected. You should get a selection as you did, get a range from it (.getFirstRange()), use for ( const item of range.getItems() ) to iterate through all the items in the range, check if an item is a text node (item.is( 'textProxy' )) and if it is, add it's data to the result (result = result + item.data). That way you can obtain the text inside the selection.
To restore something on a part of a content, you would have to save the model range in the database and then restore it and do something with it. It is okay but you would need to guarantee that the content will not change between saving range and the content (so the range won't get outdated).
I am not sure what feature are you trying to implement but it looks like you could use Markers
So I've been looking for a way to do this and found many interesting answers about Google App Scripts, but none seem to get at what I am trying to do. I am looking to have a Google Sheet (Spreadsheet) with a column of choices. Then I have multiple forms which has a question that uses a drop down menu of those same choices. However, this list of choices gets updated semi often, so we currently find ourselves manually updating 6+ forms with the new information based off of the sheet. I'd like to know if there is a way to take the information from a spreadsheet and have it automatically update the drop down list.
I haven't really done any Google Script stuff, but I can hold my own in scripting generally. I just need help finding the right direction.
You can try getting a range of values from the sheet and loop through a column until last row as below code.
var values = SpreadsheetApp.getActiveSheet().getDataRange().getValues()
for(n=0;n<values.length;++n){
var cell = values[n][x] ; // x is the index of the column starting from 0, replace x with some value
}
Once you get the values into cell variable, you can simple add them to the form drop down list.
// Open a form by ID and add a new list item.
var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
var item = form.addListItem();
item.setTitle('Do you prefer cats or dogs?')
.setChoices([
item.createChoice('Cats'),
item.createChoice('Dogs')
]);
You can refer to this documentation.
Hope that helps!
You should be able to use a formRanger AddOn which would allow you to update a spreadsheet.
This would then automatically update all the drop down dependent on the data you have added to the spreadsheet.