No video

Creating a Form In Mac Numbers Using a Script

  Рет қаралды 45,504

macmostvideo

4 жыл бұрын

macmost.com/e-2086 One advantage that Numbers for iPad has over Numbers for Mac is Form mode. If you want to simulate a form in Mac Numbers, you can do it using a few lines of JavaScript code in Script Editor and even make those script available in the menu bar. This could be the starting point for a more complex set of scripts that check values and even allow you to edit row data in a form too.
FOLLOW MACMOST FOR NEW TUTORIALS EVERY DAY
▶︎ KZbin - macmost.com/j-youtube (And hit the 🔔)
▶︎ Weekly Email Newsletter - macmost.com/newsletter ✉️
▶︎ Twitter - rosenz and macmost 🐦
▶︎ Facebook - macmost 👍
SUPPORT MACMOST AT PATREON
▶︎ macmost.com/patreon ❤️
#macmost #numbers #javascript

Пікірлер: 82
@bananababy605
@bananababy605 2 жыл бұрын
This video has been a great resource for me getting started with javascript with numbers. I've used it and figured out a few things on my own to get pretty far. I was wondering what resources are available to see the available functions? There doesn't seem to be very much. I found the library within script editor itself but it lacks a little information.
@homemixer
@homemixer 4 жыл бұрын
This so helpfull and make working with mac really easy! Thank you so much!
@treyjimmy3589
@treyjimmy3589 2 жыл бұрын
I know Im asking the wrong place but does anybody know a trick to get back into an instagram account..? I somehow forgot my password. I would appreciate any help you can offer me!
@davitavye
@davitavye 4 жыл бұрын
THANK YOU!!!!
@emanuelfrfr
@emanuelfrfr 3 жыл бұрын
Hey nice Video, do you know how to rewrite the last part of the code to ignore one cell while deleting and jumping back to the first cell. (The cell contains drop down and should not be deleted with the other ones?
@darrylczuy7244
@darrylczuy7244 Жыл бұрын
Love the video, works perfect for what I'm doing, question I have is how do you clear data from a table with Multiple columns. I want to remove the data from Column D and the script as written clears it from a the form which only has one column
@akackman3657
@akackman3657 2 жыл бұрын
Is there a way to clear the cells in the form at the end but have the cells retain spreadsheet formula setting when it is cleared?
@brandonandreasen7387
@brandonandreasen7387 3 жыл бұрын
Pretty cool is there no way to have a enter button on sheet 2 just wondering
@GilloGilloGillo
@GilloGilloGillo 3 жыл бұрын
Can you suggest specific JavaScript’s books for iOS?
@franzpaterna8271
@franzpaterna8271 3 жыл бұрын
Now it is better understanding. Can you also make a video with AppleScript? It should explain how to clear text from the column B to D. Also you can record actions (like copy text from C4 to C9). How can I record this with AppleScript in numbers?
@duanmaomao
@duanmaomao 3 жыл бұрын
Is that possible to get values of cells directly? You are using a loop. does it work somehow: values = table.ranges["A2:A20"].values().
@ajmlam
@ajmlam 2 жыл бұрын
This video was very helpful. The problem I am having is the script will not run automatically in Numbers. I followed the instruction to add the sirup and select. I notice it added "// function run(input, parameters) {" to my Script." is there something I am missing?
@sharon2436
@sharon2436 2 жыл бұрын
Hi Gary…. I am not such a whiz with Javascript and need a bit of help. I have 2 spreadsheets that have multiple tables on each spreadsheet. A checking account register (Main Table: Checking Account) and a savings account register (Main Table: Savings Account) with sinking funds, too. Right now, if I enter a Transfer to Savings in my checking register, I have to manually go to the Savings Sheet and enter the Transfer details into the register. I have specific Categories set up in my check register using a Pop-up Menu with a value of TSFR Savings to mark the transfer to savings category. Is there a way to create a script that when I select TSFR Savings that it automatically runs the script and transfers the data from that row to a new row in my Savings ledger? Or maybe a button I can create that when I press it, it looks for all TSFR Savings entered today and transfers that data to the Savings account sheet & table?
@staceycarless
@staceycarless 4 жыл бұрын
It works fine, but I can’t get the script icon to appear in the top bar of numbers
@IhabAlghazal
@IhabAlghazal 2 жыл бұрын
Thanks for the video. I have a question what would the code be if I had multiple database sheets and each one has a name and I want the values to be added to the sheet that carries the same name as the first cell of the form?
@macmost
@macmost 2 жыл бұрын
Hard to say without seeing it (and working on it). Start by learning what I show here, then try to modify in small steps.
@christinebryant9143
@christinebryant9143 3 жыл бұрын
I made a form and the script worked but it only added the first field - I only wanted 2 fields so I added a third dummy . Not sure why it wouldn't accept just 2. BUT I tried to make a keyboard shortcut and failed. I added one to the Script Editor App to run my form - exact spelling 'Script Run Form' - can you help please to solve my 2 mysteries. Thank you Gary - I love watching your videos all the way from the UK..
@mysticsunonline
@mysticsunonline Жыл бұрын
Thanks for the Great tutorial...Question: On my i-Pad is there another path than Javascript to update cells like you are doing in your tutorial which a desktop solution. It seems Javascript has been phased out in IOS to a degree. Are there other paths for moving data around in Apple Numbers for ipad or IOS devices.
@macmost
@macmost Жыл бұрын
Phased out? It was never there. You can't do this on the iPad as there is no way to write scripts like this.
@Rob-bc4yu
@Rob-bc4yu 3 жыл бұрын
Big fan of apple for video/music creation/graphic design/photography....but numbers pales in comparison to Excel. And I pretty much hate all things Microsoft lol. No ability to run/record a macro, very little scripting support unlike VBA, etc. but appreciate the content, very helpful thx!
@chrisfikes
@chrisfikes 4 жыл бұрын
thanks so much for this tutorial, is there a way to control the formatting of the new row that is created. I want it to input the data with a currency formatting but it keeps adding it in as percentage and then I have to manually go back and reformat the new data that was entered by the script
@macmost
@macmost 4 жыл бұрын
That's odd. Try changing the format for the entire column and ensure than when you manually add a new row in Numbers, it does it with that same format.
@chrisfikes
@chrisfikes 4 жыл бұрын
@@macmost it still puts in the new data as percentage; is there a format cells command in applescript?
@macmost
@macmost 4 жыл бұрын
@@chrisfikes I don't think so, but look. Have you tried formatting the data in your script? Like including the "$"? Or, try it with a new Numbers document and see what happens.
@proteus1
@proteus1 2 жыл бұрын
I wish to use the template invoice availble in number, but wish to have automation, so each time its opened or used so it does an automatic invoice number count? Can you help?
@macmost
@macmost 2 жыл бұрын
Not exactly sure what you are trying to do, but automation probably isn't the way to go.
@alexrasch2626
@alexrasch2626 3 жыл бұрын
Thanks for the video Gary! Is there a way to make a script that pulls data from a PDF file and automatically adds the data to a numbers table? I.e. a bank statement that is automatically put into numbers?
@alexrasch2626
@alexrasch2626 3 жыл бұрын
Could you make a video on this?
@macmost
@macmost 3 жыл бұрын
That would be difficult to do, if possible at all. Banks usually let you download spreadsheets already. Or if the data is in a table-like format, try copy and paste.
@dannylolg
@dannylolg 4 жыл бұрын
Hi thank you so much for all your videos very helpful. I have a question and I’m hopeful you can help me with it. I’m currently using the formula countif to give me a result corresponding to what I need ( contif A1,>O) so I aways get the results of 1 when the number on that cell is greater then 0) I would like to add a second function there but can’t seam to figure out how to go about it. I need the results of the formula to be 1 for any number great then 0 and -1 if the the number is less the . Example if cell A1 is ( 2 ) the result is 1, if cell A1 is (-2) the result is -1. Hope it makes sense. Thank you in advance 🙏🙏🙏🙏
@macmost
@macmost 4 жыл бұрын
Create a new column. In that column use a nested IF statement to test for 0 and return the right result. Then use SUM to add up that column.
@dannylolg
@dannylolg 4 жыл бұрын
macmostvideo thank you so much for your reply, I’m struggling to figure it out the complete formula for this 😅🤯
@macmost
@macmost 4 жыл бұрын
@@dannylolg I have a tutorial on IF functions that may help: kzbin.info/www/bejne/anzHo2yabb-fbM0
@dannylolg
@dannylolg 4 жыл бұрын
@@macmost thank you so much life saver :) done it , I created a column and added the formula on Cell O144 - :IF(SALE 05 UNITS
@justdnk777
@justdnk777 Жыл бұрын
Getting error from Application("Numbers"), any idea why?
@etienneb4403
@etienneb4403 4 жыл бұрын
Is it possible to put a button in the table with that script?
@macmost
@macmost 4 жыл бұрын
Unfortunately not.
@ernestoditerribile
@ernestoditerribile 3 жыл бұрын
Is there a way to clear certain cells with a button. Like the way we switch to another page on the sheet or a website within numbers.
@macmost
@macmost 3 жыл бұрын
You could do it if you know how to code. You could make an Automator script to do it. Not sure if that is in your set of skills so it is hard to recommend.
@ernestoditerribile
@ernestoditerribile 3 жыл бұрын
@@macmost I know how to Apple use Apple Scripts. But I don’t know if the scripts export to numbers in iOS, iPadOS and Web. Have converted a calculation sheet for HVAC made in XLSM with VBA Macros. I could convert all VBA to make all icons do what they did in Excel. But usually the guys who make the quotations and invoices, did it on Macs and Windows computers using Macs. I just converted it so they can do it on the fly as iPadOS, iOS and Web versions of Office 365 doesn’t support VBA Macros. Numbers does read the Excel file, but can’t do all the macro stuff so had to link so much fields to each other
@holly9833
@holly9833 5 ай бұрын
I own a cab company and we are using numbers to track most things. We are looking for help. Do you have other resources?
@PaoloMescoli
@PaoloMescoli 4 жыл бұрын
Can you make that script available for downloading? I would like to try it.
@macmost
@macmost 4 жыл бұрын
It is. Just click on the link in the description.
@paxbritannica5598
@paxbritannica5598 2 жыл бұрын
Is it possible to run an applescript from a pages file which has cells in it (my work case reports) to transfer data automatically onto a spreadsheet?
@macmost
@macmost 2 жыл бұрын
Confused by what you are trying to do. You may be able to write something complex in Automator to do what you want. It would take a lot of work and a high level of coding skill. I'd consult with a coder about it if you want to proceed.
@paxbritannica5598
@paxbritannica5598 2 жыл бұрын
@@macmost I'm just trying to do the same thing as in the video except between two apps, pages and numbers
@brianforrest6047
@brianforrest6047 2 жыл бұрын
Hi Gary, I am using your scripts with my spreadsheet. I see you have 2 Columns labeled "A". How do I do that for my spreadsheet Form?? Thanks, Brian
@macmost
@macmost 2 жыл бұрын
Not sure what you mean. There is only one A column in a table. But I am using multiple tables here.
@BabaGanoush512
@BabaGanoush512 3 жыл бұрын
Thanks for this! Im very new at this, I followed step by step and copied everything as is but I keep getting an error Error -1700: Can't convert types. If I look under Replies I get this. app = Application("Numbers") app.documents.at(0).sheets.at(1).tables.byName("Data Entry").rows.length --> 4 app.documents.at(0).sheets.at(1).tables.byName("Data Entry").rows.at(0).cell.0.value() --> Error -1700: Can't convert types. Result: Error -1700: Can't convert types. Any help understanding this would be greatly appreciated. Thanks again.
@BabaGanoush512
@BabaGanoush512 3 жыл бұрын
Found the issue :)
@justdnk777
@justdnk777 Жыл бұрын
@@BabaGanoush512 May I how you fixed it, Rick? thanks!
@mikeneirinck189
@mikeneirinck189 3 жыл бұрын
can the script be tied to the spreadsheet instead of the app?
@macmost
@macmost 3 жыл бұрын
Not sure what you mean. It is tied to a spreadsheet.
@mikeneirinck189
@mikeneirinck189 3 жыл бұрын
@@macmost If you would share the spreadsheet with other users on another Mac or even an iPad/iPhone would the script be available?
@macmost
@macmost 3 жыл бұрын
@@mikeneirinck189 No. The script is a separate piece. Automator is a Mac app, so even if you sent them the script, there is no way to run it on an iPhone or iPad. But the iPad version of Numbers already has forms.
@mikeneirinck189
@mikeneirinck189 3 жыл бұрын
@@macmost It does. As the number of added records could increment fast I am a bit scared numbers might slow down. So I am considering simply adding a value to the previous one and that requires a script.
@Curru21
@Curru21 2 жыл бұрын
This is an useful script and I love it, but you make a script where you need to add a pop up menu in the form table and then the script identify what table needs to fill according to the selection of the pop up menu? Regards
@macmost
@macmost 2 жыл бұрын
Yes, probably. It will take some work but if you have some coding skill you can probably work something out.
@antoniagia6482
@antoniagia6482 2 жыл бұрын
T Tutorial in italiano, grazie
@aayushjain2544
@aayushjain2544 4 жыл бұрын
how can we add shortcut to that button
@macmost
@macmost 4 жыл бұрын
To the menu item that runs the script? Try doing it in System Preferences, Keyboard, Shortcuts.
@alyceyee5011
@alyceyee5011 3 жыл бұрын
@@macmost hi sir! can you explain in details how can I add keyboard shortcut to "Submit Form"?
@macmost
@macmost 3 жыл бұрын
@@alyceyee5011 kzbin.info/www/bejne/lWWanH2siJ2hns0
@SimanjeetSingh-hf2xy
@SimanjeetSingh-hf2xy Ай бұрын
@@macmost that isn't really helping. Could explain the process, Cause in the video it does it for only the left side of the menu bar and script is on the right side.
@SteveFlatEarth
@SteveFlatEarth 2 жыл бұрын
I'm ok at AppleScript programming but I'm a little lost with what you are doing. I sent you an email. Hopefully it gets to you. I'm basically trying to move a row of data in one table to a particular row in another table on the same sheet. It's possible? What programming language is best to use? Javascript?
@macmost
@macmost 2 жыл бұрын
Use AppleScript or JavaScript, whichever you are more comfortable with. But how often do you need to do this? It is easy to do with copy and paste. I would only work to create a script if you have to do this so often that the time it takes to create the script will pay off. Even then, maybe there is some other workflow that could lead to not having to do this so often.
@SteveFlatEarth
@SteveFlatEarth 2 жыл бұрын
@@macmost I have to do it every 30 minutes so definitely worth it to script it. I'm stumbling trying to script it but hopefully will figure it out. Trying to use your javascript and modify that because I'm not sure how to do it with applescript. Can't find any examples.
@SteveFlatEarth
@SteveFlatEarth 2 жыл бұрын
@@macmost Do you know if there is a javascript command to force STOCK function to pull new data without the necessity of restarting numbers? Also I'm following your example but I don't want to create a new row since my table is precreated at the beginning of each day manually. I just want to transfer the data from the column of one table to a column of another data and I want it to paste the formula results since the originating table is a formula. Just stuck on these various parts. Otherwise it's close to working :-)
@macmost
@macmost 2 жыл бұрын
@@SteveFlatEarth The STOCK function in Numbers only gives daily numbers (FYI). But it should update automatically when you open the document. Otherwise, just change one cell to update all formulas. A cell with a checkbox in it will work for this purpose.
@SteveFlatEarth
@SteveFlatEarth 2 жыл бұрын
@@macmost Thanks. I'm still struggling with converting your example to my needs. I just need to transfer one column of data in one table to an existing column in another table in the same sheet but I have zero experience with Javascript so I'm stumbling a bit. If you can check my email I think it's something very easy to do. I'm willing to pay you for your time. Thanks.
@thebittenmac
@thebittenmac 4 жыл бұрын
Or use a database app …
@AppleSoft
@AppleSoft 3 жыл бұрын
But which one on a mac? Any suggestions?
@ernestoditerribile
@ernestoditerribile 3 жыл бұрын
@@AppleSoft FileMaker Pro
@v4uevents
@v4uevents Жыл бұрын
can we create form… WITHOUT using script ?
@macmost
@macmost Жыл бұрын
Not in Numbers on the Mac. You can do it in web-based systems like Google Forms. It depends what you are trying to DO.
@spacedudey2k
@spacedudey2k 4 жыл бұрын
I will NEVER understand programming
@krunchyboi107
@krunchyboi107 3 жыл бұрын
This is so awful that Mac has made it too difficult and it can't be simple as it was in the past...Too much work for the average user
@Trackhoe075
@Trackhoe075 3 жыл бұрын
Maybe it’s me but why make this so damn difficult just enter the number on your first sheet? Easy peasy !!! I don’t get how writing JavaScript makes this sensible! Geez just enter it once in the first sheet! I’m certainly not gonna spend hours learning JavaScript to enter 4 numbers nope not me! I got other problems if I can’t enter info in four cells like major problems! First of all I would duplicate whatever setup on both handheld and desktop! The info on both desktop and iPhone or iPad in either numbers or pages, and both will be updated over WiFi …..DONE
@rubberk
@rubberk 3 жыл бұрын
kzbin.info/www/bejne/Z5SxhXyhZrBqaLc
@franktognini4786
@franktognini4786 2 жыл бұрын
I watch serval of your video that I like but I keep going to different video and you never show a simple step, where do you switch to script editor, each video where you talk about script editor I have to stop the video and give up because I cannot find that. so simple and you just go to it assuming we all know how to do that, so frustrating