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.
Sync only these folders
and only select the appโs file/image folder (where workflow files are saved). 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.
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?
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โฆ
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!
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.
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.
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:
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.
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.
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?
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.