CLASP Tutorial - Google Apps Script - How to Install CLASP
Vložit
- čas přidán 19. 04. 2020
- Learn how to setup CLASP to work with Google Apps Script projects locally.
For more on this topic & help with installation check out & subscribe to my other channel:
/ @getitdonetube
If you're already familiar with Node JS and Visual Studio Code environment, you can skip to 6:30.
Links you may need:
nodejs.org/
code.visualstudio.com/
github.com/google/clasp
script.google.com/home/userse...
#clasp #tutorial
I have to say, i have been following this buddy channel for a while and you helped me to make a way in the coding world. Bro, you deserve a place in heaven. Thanks a lot, no words to describe how useful are your videos and explanations...
@HARIKRISHNAN R i can't believe what I've just read 🤣🤣🤣🤣🤣🤣 you have got to be kidding...
@@apolovzla_ccs Cool! Now this is what CZcams comments are supposed to be like! :)
Even if I've done this before, I find myself coming back to this video to restart new projects! Thanks! Even after a year of programming with google sheets scripts...I am still coming back to this video to get new projects started. It's invaluable!
Man!!!! This is extremely AWESOME!!!! Thank you very much to show it to us.
Thank you, youtube finally decided to offer me this video of yours!
Been thinking about something like that for a really long time!
You have the Best Spreadsheets Tutorials on the internet!!!! No exception here, thanks man!
This tutorial was awesome! Very clear and understandable!! You Rock!
That's very nice and thoughtful of you to take care of both PC & MAC users! It's always fun to watch your video about google script.
Sir, this is something I always wanted to do.. thanks a lot! You're the best teacher I have ever found in youtube!
I'm so appreciative of this video... from setup to troubleshooting, I've relied on it a few times already, even until just earlier today
Liked it. Thanks again sifu. U're my savior, bro. For many times!!!!
Please keep teaching us 🙏
Amazing tutorial. Thank you so much. This is honestly like candy for my brain. I just get so excited learning this stuff knowing how much you can do with it.
:)
Thank you for publishing this video!!!
Very helpful ! Once again ! Thanks !
Hello. You are the best, man. Thnx for your work.
Awesome tutorial. Thank you for making this.
Great job! Excellent tutorials! 🙏
Glad you like them!
Great!!! it's a very useful tool.
Many many thanks for that!
GREAT Video, that's what I need, thank you 😀
Glad to hear it!
Awesome!!!👍
You, sir, have earned a subscriber.
Welcome aboard!
Наконец то мою просьбу услышал =) Thank you
Man, você é o cara!
Amazing.
Thank you!
Thanks for watching!
Great video as always. I just wanted to add that if you write a wrong line in your local file, it will be not uploaded in your remote repository after you do a clasp pull.
Thanks for the tip!
Awesome video as usual!
Glad you enjoyed it!
@@ExcelGoogleSheets All the steps worked fine for me. I tried to create subfolders in src folder to have a more organized project files, but when importing another project, it says "No valid .clasp.json project file. You may need to 'create' or 'clone' a project first". I saw on github they allow one file per project, but when trying to modify this file to import another one, it fails.
My suggestion: make another video showing how to clone multiples projects id's; does Visual Studio support the 'working with Libraries in Google IDE'?
You need to create a new folder separate from the old one and repeat the same steps. Don't add multiple projects within that same folder.
@@ExcelGoogleSheets It worked! Great! Thank you so much! But it's a 'bad' thing, because I'll have separate folders to pull/push with clasp. All this because for a big project with GAS I usually create several files for a better organization. But if i put all my .gs files in one google file using this notation 'folder1/fileA' , 'folder2/fileB', and so on, clasp will create folders 'folder1' and 'folder2' with their respective files in one project folder (as written on github description), then I'll have only one project to push/pull. That would be a lot of files .gs in one google alps scrpit file, but if I am using clasp, it's because I want a better IDE.
Thanks for this
Nice video keep uploading
Thanks a lot.
please, more videos about clasp!
Thanks for the step-by-step tutorial.
The only benefit of using CLASP over the default online IDE is the debugger. The debugger of the default IDE really sucks. You cannot add custom variables to watch. Which wastes a lot of time. Because you have to drill down to the specific index of arrays to see the values. The other option is to use Logger, which also is a time wasting technique.
So, in my opinion using Visual Studio Code debugger is the only benefit of doing all this. If you would have covered the debugger in this video as well, that would be really good.
Thank you
How about debug, can create subfolder contain file .cs , .html
Thank you for lesson. Can I run the debugger in Visual Studio Code? Or CLASP needed only for writing code, and the debugger run only in the browser?
I don't think you can..
quick question: when we do clasp push (it looks like git push), does that push the local code into the 'master' branch (i.e. GAS) directly or is it first stored into an intermediary clasp server? i'm thinking security, and if this is safe in the context of developing enterprise or client code
It goes to GAS directly, but it doesn't get deployed. So your latest deployed version of the web app will remain the same. Your dev version will change.
If you want to do version control you should still be using git in addition to this, because Apps Script doesn't have a good version control.
Master, want to learn about using OAuth2.0 with Apps Script.
Up
codeburst.io/simple-oauth-in-google-apps-script-d21f88cf63c4
thanks for the video. I have an issue with the getRange. It seems that after I push the modification on googlescript, it can not identifier which getRange I used (since there are 5 types). It may be my mistake to not write it correctly at VS also (new player on it)... thanks
I don't understand. What's the code you wrote?
@@ExcelGoogleSheets I write down the getRange commander at VS and after I push to Google sheet, it seems it doesn't pass with some reason. I have to erase it and rewrite the comande lien at Google sheets. Thanks
👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻
I will definetely try it, but when we talk about deployment does it support frameworks or libraries on the server side?
Yes front-end, no back-end.
very nice! I was able to use CLASP on windows in cmd but not in VS code. Is there a way to open the terminal in VS code on windows as Admin as you did on Mac?
It sounds like you forgot to push the changes. Dev should work just fine. Just setup "clasp push -w" and you should be fine.
Also make sure you get the latest dev link.
Open VS as Admin (This should open the terminal as admin too).
If you get an error like "execution script are not enabled"... or something like that. Open PowerShell (As Admin) and paste this command: "Set-ExecutionPolicy Unrestricted". Type "S", and everything should be fine now (i hope).
edit: (All this done on win10)
This seems promising. Is it possible to see result of code from VS Code in browser (using live view or similar) as it would appear on google server? If so, does this work using the "" style? Google js file is js.html so might not work?
The easiest thing to do is to open Web App dev link in your browser and setup clasp push --watch. This way all changes you make are automatically applied on the server, so you can just work as usual but use your editor instead of web editor.
You are still going to be writing exactly the same code.
just in case, someone might want to check stackoverflow for this issue “execution of scripts is disabled on this system.” if your vm running in windows 10.
how can I require/import a file ? will have the same behavior?
You can't require is apps script.
You can however use import/export and compile it to a javascript file. I have examples of doing that on my other channel if you check under about section.
Hi friend, I did everything what you told but for the code autocompletion and methods information(intellisense), I cant see on visual studio code, do you know why?
Edit: Fixed, you have to create a file named jsconfig.json on the root folder(where your .clasp.json is) and put the below:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs"
},
"exclude": [
"node_modules"
]
}
Usualy, just closing an reopening VSCODE solves this problem.
#StaySafeStayHome
The follow-up could be vuejs on gas.
:)
This is awesome. The only thing not working is the autopopulate for metas - I've got the latest clasp version, but when I run the second command, nothing happens. anyone having the same issue?
as far as I can tell, you need to run the npm i -S @types/google-apps-script command in the root folder for each project you make ¯\_(ツ)_/¯
I am wondering how to use Logger when I run code in Visual Studio Code?!
Logger is not available. you can setup console.log to work and use "clasp logs" github.com/google/clasp#logs. There are some other consequences when you do this setup, so do it on a test project first.
Got to cloning part and nothing happens. I end up with the > prompt. I have tried this in the VSCODE terminal and the terminal on my computer.
any help appreciated
EDIT - I went to the github commands reference and cloned using the URL rather than the project ID.
- I still would like to know why the other way did not work.
Maybe check this video for installation instructions czcams.com/video/4UYe5aMHXfs/video.html
Is there a way to run the code (to test it) using Clasp on your local computer? Or do you have to always use the google browser interface to run code?
There is one, but I don't find it particularly useful. It also requires you to port your project to self managed project in order to be able to run the functions. Once you port there is no way back.
@@ExcelGoogleSheets I asked because my interest in Clasp was to work more "off-line" to avoid the interruption to my coding workflow that happens when my internet drops at times. But if I can't run the code to test it, I don't see why Clasp would help me. Still, your instructions are great.
Running functions is not going to work offline.
Anybody knows why clasp -v doesn't show me the version (it seems it doesn't run the program) meanwhile if I write clasp -v on the command prompt it works? (On visual studio I get FullyQualifiedErrorId : UnauthorizedAccess) (I've windows 10).
Your tutorial are the best! keep it up!
Try this www.donovanbrown.com/post/Using-PowerShell-in-VS-Code
@@ExcelGoogleSheets thanks for your fast answers! You're very kind. Actually I've solve the problem following this link: stackoverflow.com/questions/56199111/visual-studio-code-cmd-error-cannot-be-loaded-because-running-scripts-is-disabl . I think it's the same solution. I share that for everyone that has similar issue.
I'm always waiting for your next video! Bye
Google Sheets Script editor?
all of your tutorials code are available to patrion?
I want to do it starting next month. Do you know a good place/way to host this type of thing?
What about debugging?
I tried to use this solution on web Apps but everytime I push data to Google Apps Script I have to deploy the app for being able to test it. Is there a way to use the dev option to test the latest code using CLASP?
Are you not able to do all the other commands other than installation?
Did you try? What message do you get?
I wish we could use vscodes debuger :(
Can we create css files then upload them like .html files ?
You can make it work that way. Learn more on my other channel czcams.com/channels/JebzvfCuA5ymtb79DQm36A.htmlvideos
11:51 First commands
Без відладки сенсу немає. Здається є можливість налаштувати авторизацію через OAuth2, але якось напряжно
i have a problem when i clasp clone it said couldnt find script
Check the script id
@@ExcelGoogleSheets lol it's not the script id. I put space in root Dir. Thx man for replying
Success in stall clasp on Linux Mint but fail on "clasp -v" . Can not call program clasp.
Try
sudo apt-get update -y
sudo apt-get install -y clasp
and then check again
@@ExcelGoogleSheets Thanks, Succcess by installing new NodeJS. but stuck with the last step, autocomplete does not work.
When you open package.json file does it include "dependencies": {
"@types/google-apps-script": ?
@@ExcelGoogleSheets
It appear like this.
"dependencies": {
"@types/google-apps-script": "^1.0.12"
}
@@ExcelGoogleSheets Today autocomplete can work without doing anything. Maybe only restart Visual Studio. Thanks for your caring