How to Use Google Sheets as a Simple CMS
ฝัง
- เผยแพร่เมื่อ 4 ก.ย. 2023
- Let’s raise funds for St. Jude! codinginpublic.dev/fundraiser/
While not ideal for anything complex, Google Sheets can act as a very simple CMS. In this video, I'll show you how to set up a simple API endpoint that returns the results of a Google Sheet as JSON.
🔗 Key Links 🔗
- Google Docs: developers.google.com/apps-sc...
---------------------------------------
🎨 VSCode Theming
- Font: Cascadia Code: github.com/microsoft/cascadia...
- Theme: marketplace.visualstudio.com/...
- Icons: marketplace.visualstudio.com/...
---------------------------------------
🌐 Connect With Me 🌐
- Website: codinginpublic.dev
- Blog: chrispennington.blog
- Twitter: / cpenned
- Patreon: / coding_in_public
- Buy Me a Coffee: www.buymeacoffee.com/chrispen... - แนวปฏิบัติและการใช้ชีวิต
This isn't something I was expecting learning today, but it does bring ideas for other things 🤔
Yeah, not sure how much I’ll use it going forward but it’s a nice little tool when you need it.
Finally someone made Excel as database.
“Database” 😉
Unexpectedly useful. Haha. I don't think I'd ever search for this, but it gives me some ideas already. Will try to deploy something this week! Thank you 😎
Ha same! I was racking my brain trying to think of a simple solution and this is what I found!
Super cool. Thank you for sharing. 🙂
You're welcome! I was surprised when I ran across this last weekend and just had to share! Could be useful occasionally!
I was thinking something like this today. Totally shocked! 🎇
Haha! Nice timing!
nice thank you so much keep up the goo work!
Thanks, my friend.
Instead of this method I pulled the data into my main server using a google service account json and broadcasted using a self hosted api. Then pulled into the other site I was running. I like this google scripts method. Might give it a go. I think there are higher limits when using the service account though.
Awesome. Currently I use Google Sheets for project budgeting and then, imports my tables to my project proposal.. Maybe I con follow your approach to automate task.
Keep up the good work ! 🙌🏻
Thanks!
thank you for this video, i love it.
You're welcome 😊
Thank you man
You're welcome!
Very cool!
Yeah, it was a fun discovery!
that is pretty nifty!
Don't tell the real devs, but I'm using this a lot and really enjoying it for simple little projects and forms. :) It's really nice when posting content, too.
Please , can you make a full video on how this google sheet can be transformed into a complex database with more than 4 API endpoint, it will really be nice for my learning, Thank you😊
I wouldn't use this for a more complex database :) So I probably won't be making a video on it. I'm hopeful this gave you enough to get started though!
do you have more complex examples using gsheets?
Not really. I don’t think I’d personally do something much more complex. At that point, I’d probably just use a CMS? Got any idea for how you’d use something more complex?
Do you think it would be a good idea to use this as a cms for a job posting web app. I want to post only selected few jobs and most probably it'll be done manually.
Possibly? Probably depends on how frequently the jobs would change. I have no idea how fast this is speedwise, etc.
Will you make video about next or react again ?
Sure, have plans for it! I typically just do videos on whatever I'm learning/working on at the time. Been on a big Astro kick with 3.0, but have plans for more React (I've never actually done anything with Next on the channel, but I just built a site with it…so it'll probably happen :)
LOL, fun idea.
Yeah, it was a nice way to provide a very low friction way to update the little landing page. Not sure on the speed of this but the site I used it on gets like 15 views a week and is literally a single page :) So figured if there was ever a time to try it, it was on this friend’s site.
First time I did it when this video came out - worked and works just fine. But when I create a new sheet and make same steps it throws me an error: Unexpected token '
Is this a sheet in the same google doc that is working? If so, it's probably line 3 here: th-cam.com/video/15y1D1mGKdE/w-d-xo.htmlsi=VXqVrHXwU_DVthQ2&t=174
You'd need to account for multiple different sheet names.
@@CodinginPublic thx!!!
function doGet() {
const doc SpreadsheetApp.getActiveSpreadsheet();
const sheet doc.getSheetByName("Hours");
const values sheet.getRange(1, 1, 5, 2).getDisplayValues()
const result values.map((h) => ({
name: h[8],
hours: h[1]
}))
return ContentService.createTextOutput(JSON.stringify({data: result))).setMimeType(ContentService.MimeType.JSON);
}
"Not sure if correct but ye thas the code i guess"
I was intrigued with the google sheets.
But you explained it so well
And im invested to give it a try 😎
nice! Glad you enjoyed the video!