DIY Replacement for Google Cloud Print (Shutting Down Today)

GreenFlux
Participant V

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,328
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โ€

MultiTech
Participant V

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.

Ethan_U
Participant V

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