DIY Replacement for Google Cloud Print (Shutting Down Today)

With Google Cloud Print shutting down today, I decided to try building an app that would auto-print files as they are generated from a workflow.

This is a 2-Part Challenge:

  • Getting the cloud file out of AppSheet and onto the local machine
  • Auto printing files as they arrive

And each part has a different solution depending on the OS of the device connected to the printer (Mac, Windows, Linux), and which storage provider you’re using (Google Drive, OneDrive, Dropbox, etc.).


This solution is for Mac users, but the same technique could be used on Windows, by replacing the Automator folder action with a VB Script, Power Shell, Auto Hotkey, etc.

  1. Install Google Backup & Sync (or OneDrive, Dropbox, etc), and login with the same account as you use for AppSheet.
  2. (Recommended) Select Sync only these folders and only select the app’s file/image folder (where workflow files are saved).
    3X_a_0_a043a91355679d7d608f40e8550882b41cd02aa6.png

NOTE: ALL FILES in your root My Drive folder will sync, no matter which settings you choose. Move everything to a new folder FIRST to keep from syncing.

  1. Run a test workflow and make sure new files are syncing to your local machine.
  2. Create a new Folder Action in Automator, select the folder, and add the step “Print Finder Items”

In my tests, the files showed up on the local machine at almost the same instant that the sheet change occurred, and printing automatically started just a few seconds later!

This works great for a single app, but I can’t figure out a way to print from multiple apps without monitoring each folder. An app can only save images to a subfolder of the app’s default folder.

Ideally, I’d like to be able to monitor the same one folder, and send all print requests from all apps in my account to that one folder. I tried with webhooks, but you can only send the row data.

You can send a link to the file from one app to another, but that doesn’t create a NEW file in the receiving app’s default folder. I could use Integromat to copy files from other apps into my one “print queue” folder, but I’d prefer to find a native AppSheet solution.

Does anyone have any ideas on how one app could create a file in another app’s folder, without using some external integration?

9 60 3,383
60 REPLIES 60

With the old Google feature as “Add to my Drive” you can have all files in the same folder. You can activate it with Shift+z.

@Aleksi, I couldn’t get this to work. Maybe we’re talking about two different things. I’m trying to get one app to save new files to another app’s folder.

The goal is to “Print” files from any app into the one “Print Queue” app’s folder-- without having to manually ‘add to drive’ on each file, or add a common sheet to all apps.

But I don’t think it’s possible without Apps Script, Integromat, etc. I don’t see how the “Add to Drive” feature can help with the AppSheet limitation of only being able to save files to subfolders of the app’s main folder.

Interesting…

3X_c_7_c77e4a88179a16ed67b2a9dbd440984f5749f4b0.png

I never knew about this.

Is this only for files? I need a whole folder mirrored. Where did you find that, @MultiTech_Visions?

I googled “shift z in google drive

Nice one mate! 3X_d_5_d51363a862e7ab883241c312ac5d7f271579cdd3.gif

In order for the app to have access to a folder, you’d need something inside the app that’s stored in that source - like a table.

Then your app would have authorized access to the folder (from your appsheet account accessing the folder) and you could easily affect things then.

But aside from that, you’d have to have an external integration to handle this.

  • You could create a script on the drive, and integrate that with a corresponding table in your app that triggers that script (which would migrate your files).

Yes it works

Lets say you have an app in Root > Appsheet > Data > App#1-1234567 and you have subfolder called “Files” under that folder. Now if you select that “Files” folder and then Shift+Z, you can add that folder to Root > Appsheet > Data > App#2-1234567. Then your app is able to use that same subfolder for this 2nd app as well. Your app has access to your files even they are all in the same subfolder.

Hmm… I tried this, and AppSheet ignored the shortcut version, and created a new folder with the same name, instead.

3X_a_3_a3e50ec7e813a1092201a0a45c6e60dd7d984070.png

Also, when Google Backup & Sync adds the shortcut to the local drive, it has a *.shortcut file extension, and does not show as a real folder. So adding files to the actual source doesn’t get reflected on the local drive anyway, and wouldn’t trigger a ‘new file’ to invoke the Folder Action.

Am I missing something, @Aleksi? My app wouldn’t use the shortcut, so it doesn’t really help in this case.

I got it! Thanks @Aleksi!

I deleted the shortcut and tried again using the keyboard command. That brings up the hidden Add to Drive which is different than the menu option Add shortcut to Drive, which I had been using.

You mentioned the shortcut, but I didn’t realize it was any different than the menu option version. It only works with the hidden, Shift+Z version!

Thanks again, @Aleksi! This will be way better than having to sync and monitor tons of different folders.

You haven’t used “Add to my Drive”, You have used “Add shortcut to Drive” and that doesn’t work. It works in gDrive, but it doesn’t work in API level. When your app tried to save your file, it didn’t find that subfolder, and then it created a new one.

You can find the difference if you check the folder symbol. When you use “Add shortcut to Drive”, it adds a small arrow to the left bottom. “Add to my Drive” doesn’t show that.

WOAH! It even works across accounts!
This will be very useful for public apps that are linked to a secure app in another account. Great tip, @Aleksi!

You’re welcome

It works as it has nothing to do with your Appsheet account(s). The only thing is, the API needs to see it.

I know you said “without using 3rd party tools”, but I’ll put this here anyways.

Printnode is pretty nice. You download a client software onto a computer to act as your print server. Then you can print jobs with a POST request to their API. You get 50 prints per month for free. You can send jobs with a publicly available URL to a PDF document, or with a 64bit encoding a PDF document (I have NOT tried the latter).

Here is a setup that I have using this print service. Note that this requires one to disable the security options that allow public file URLs from Appsheet.

This app runs a daily MakeDoc Report, with a set filename, and timestamp disabled:


Then an hour later it runs a daily Webhook Report


Given that printnode can accept 64-bit encoded files, perhaps there is a way to send jobs without having to disable the security options, but I have not attempted that in any way so cannot comment any further.

3X_d_5_d51363a862e7ab883241c312ac5d7f271579cdd3.gif Noice!

Hey Marc_Dillon, this is a great solution. I’ve been wrestling with this and the Zebra SendFileToPrinter API for the past couple of days. For the PrintNode version is there anything you ran into that would give you a 400? I’ve tested my JSON as valid and my publicly available URL in “content” is accessible. I’m authenticating via Authorization: “Basic myapikey”.

I’ve used curl to test my API key and it returns a 200 valid. I’m pretty sure I’m doing something incorrect at the Appsheet end but I’m not certain what.

I’m running a workflow that will print off a barcode each time a new row is added in a table. That barcode being one of the columns in the row. I’m just using a test PDF right now that is in the same folder as the app spreadsheet.

Any ideas?

Thanks!

400 is a bad request.

Post a screenshot of your webhook definition. Also post what the actual payload is from the logs.

Hi @Marc_Dillon, this is what I have!

Thanks, Justin

I did some testing, and I couldn’t get your doc to print either. Can you output it as a pdf and use pdf_uri? I feel like I have better luck with that. I’m not sure what a “raw_uri” even is, or at least I just forgot (haha!).

Same deal with the pdf_uri. If I reference the file from my local computer Google Drive folder via the PrintNode web app it works fine. I’ve also tried the Zebra SendFileToPrinter API and same deal. With that one I tried Postman, referenced the zpl_file in my local computer Google Drive folder and worked fine as well. But if I reference the file from web end it doesn’t work. Appears to be something to do with how I’m referencing the Google Drive file but can’t pin it down!

Hi Marck, could you please tell me how I should configure the print node account in the webhook section?

You don’t. You send a webhook from Appsheet to printnode. This screen is for sending a webhook from printnode.

hi Marc.

I have already configured everything as you indicate, but when testing the webhook I receive this error. could you give me a hand please


I am assuming that in hrttp heather you should put Authorization basic and “the key of print node” if it is ok?

Based on the error shown, the issue is that your JSON payload isn’t structured properly. I’m not sure of the exact issue, try and re-type the whole thing?


@Marc_Dillon Hello could you tell me please how I find the http heathers for example Authorization: “Basic …”

You get your API key from here:
https://app.printnode.com/app/apikeys
Then 64-bit encode it with a service like this:

That’s the value you enter after “Basic…”.
Say it is XXX, your entire HTTP Headers field would be:
Authorization: "Basic XXX"

if this worked, thank you very much @Marc_Dillon

Hello, @Marc_Dillon do you know if there is any way to monitor the print jobs in appsheet to know if they were printed successfully or not? I understand that printnode has a way of doing webhooks too.

Appsheet webhooks are fire and forget, so no, they can’t receive any returned info about success or failure.

You could perhaps set up printnode to shoot a webhook back over to Appsheet. I can’t really provide anymore info here.

Also, consider that success or failure of your print job does not necessarily depend on the success or failure of the webhook, there are other factors (like the physical printer).

Hi there, thanks for sharing, I am working with the printnode too.

I was success to print, but I am stuck with replacing the content URL with the file that created by workflow. Can you share the syntax for the content?

Below as my file link:
https://www.appsheet.com/Template/gettablefileurl?appName=CloudPrint-1982313&tableName=Master&fileNa...

I pretty sure the file is created, and save in Files folder. But I just fail to open the file with above URL.

Please help, appreciated.

Thank you.

There is nothing I can add that is not already in the initial screenshots.

Have you disabled the security options for files?

If you can’t open your file URL in a separate browser window (best to test in a private browser session), then printnode can’t open it either.

Ya, it is disabled. Shall I disable the Require Image and File URL sigining too?

Does my link is correct?

https://www.appsheet.com/Template/gettablefileurl?appName=CloudPrint-1982313&tableName=Master&fileNa...

I don’t know, try it.

Nope, I cannot load it.

Please read also my update at the end of this thread.

so far I haven’t noticed a speed difference between emailing an attachment to an Epson printer email or doing this version where I make a doc in the workflow that syncs to a local folder which fires the mac automator action.

each takes about 25-35 seconds to print. Have you been able to achieve something faster?

@Ethan_U at least on a 2nd print the file is already local. That is the added benefit with this method

@Henry_Scott Great point. I guess the only outstanding use case then for us at our restaurant is Purchase Orders which are unique each time.

@Ethan_U yes same here. In my case it is an Access Ticket that I must issue a customer at my premises. So 25 x seconds per Ticket with 100 people queueing is not an option.

Top Labels in this Space