DEV Community

loading...

A quick way to create Google documents.

mark_nicol profile image Mark Nicol ・1 min read

A question - triggered by a quick productivity tip a colleague showed me this week.

If you are a Google Drive / Documents user you can create a new document by typing the document type followed by .new in the browser bar.

This creates and opens a blank document of that type in your Google Drive.

The ones I've seen documented are:

  • Docs: doc.new, docs.new, document.neworms: form.new, forms.new
  • Sheets: sheet.new, sheets.new, spreadsheet.new
  • Slides: slides.new, deck.new, presentation.new
  • Sites: Slides: slides.new, deck.new, presentation.new

Do any other tools have anything this neat - that I've just missed?

Refs:

Quartz at work: Google has a .new timesaving tip

Discussion (12)

pic
Editor guide
Collapse
kaelscion profile image
kaelscion

I saw this post and it got me thinking. You can totally do this programmatically with Python. The script below is Python 3, but this would work with 2 as well without the 'f' string:


import requests
import webbrowser

def open_google_doc(doc_type):
    r = requests.get(f'https://{doc_type}.new')
    webbrowser.open(r.url)

open_google_doc('sheets')

Something tells me this has potential of some sort, but I have no idea what it would be. Let me know if any of you could think of a reason to use this :P

Collapse
kaelscion profile image
kaelscion

For me, my inner web-scraping wonders if there are other browser commands that can be exploited in a similar way. Perhaps the correct json data in a header for requests could open and append data to a new document. Then, a different request could read it back. Perhaps this could be used for a quick notes web app, or filtering system for data you currently have in a spreadsheet, or retrieve a particular slide? That way you can do quick, one-off reads and writes from a front end UI that leverages the in-place cloud infrastructure of the g suite rather than building your own? Then anybody who can collaborate on those docs could do the same, no Docs API key necessary. Hmm....would this be the type of framework any web devs would find useful?

Collapse
mark_nicol profile image
Mark Nicol Author

That is an interesting thought. I'll now be pondering that one too, but I have no good answers.

A very crude way of logging when an event happened?

Collapse
nektro profile image
Meghan (she/her)

Works in Firefox too 🤔🤔🤔

Collapse
mark_nicol profile image
Mark Nicol Author

Yes, you are quite right, digging a wee bit it looks like it should work just about anywhere.

The 'magic' seems to be in the '.new'. What it seems to be doing is requests are redirected to a google document creation URL. (e.g. doc.new becomes a request to docs.google.com/document/u/0/create) - which from the quartz article was an older hack for the same thing.

Collapse
nektro profile image
Meghan (she/her)

Ah, didn’t realize new was a valid TLD

Collapse
tux0r profile image
tux0r • Edited

Hmm. Open your locally installed office application and press Ctrl+N - should do the same thing (but faster). Except on Macs where it's Cmd+N or something, because reasons.

Collapse
mark_nicol profile image
Mark Nicol Author • Edited

Yes. I've found that one super useful in the past when you already have the app open on another doc. Is there any smart keyboard shortcut for opening one of the office apps? - I know you can use windows key or cmd-r and then select the application.

Collapse
tux0r profile image
tux0r

Tried Clavier+ on Windows?

Thread Thread
mark_nicol profile image
Mark Nicol Author

Thanks, I've not tried Clavier+. Will take a look. You've reminded me that I used to find a similar tool called KeyText dead handy for quick scripts in Windows.

Collapse
nektro profile image
Meghan (she/her)

⌘ is the replacement for CTRL in pretty much every shortcut on macOS

Collapse
tux0r profile image
tux0r • Edited

Ah, thank you. I did not have to use a Mac in five years.