Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to write to different tab on same excel file

johnnykoung
8 - Asteroid

Hi,

I created a workflow that I want to output to one excel file but on different tabs for each output. I'm running into an error that says it's unable to open the file because it's being used by another process. I'm assuming that this is because the file is being written on at the same time by the other output in the same workflow.

What can I do to fix this, so that I have one workflow with two outputs on different tabs of the same excel file?

Thanks,

Johnny

5 REPLIES 5
JosephSerpis
17 - Castor
17 - Castor

Hi @johnnykoung are you using the Block until done tool before the Output Data tool as this usually helps me when I'm writing to an Excel file and output to multiple tabs in the same file? 

AlteryxUserFL
11 - Bolide

To fix this, you need to use a block until done tool or the crew macro parallel block until done tool. This will stop Alteryx from trying to access both sheets at the same time. 

 

DrewDavis_0-1589800322521.png

 

 

 

 

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @johnnykoung,

 

There are a couple of ways to do this,

 

Method 1: You could take advantage of the batch output method at the bottom of the output tool. Select the checkbox "take file/table name from field" and choose "change file/table name" in the dropdown. Finally select the field you want to use as your sheet/tab name in the dropdown (i've chosen category in my example below). This will output the row of each unique category into a new tab (Office Supplies, Technology etc).

 

Jonathan-Sherman_1-1589800140857.png

 

Workflow:

 

Jonathan-Sherman_0-1589800124638.png

 

Excel File:

Jonathan-Sherman_2-1589800188073.png

 

 

 

Method 2: You could use a block until done tool to only run one output tool at a time and take the sheet name from a field (i've created a custom sheet name in a formula tool)

Jonathan-Sherman_3-1589800471194.png

 

Jonathan-Sherman_4-1589800495511.png

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached both methods for you to download if needed.

 

Regards,

Jonathan

 

 

 

ahmed1
7 - Meteor

Thanks DrewDavis

 

ChrisTX
15 - Aurora

I've used the Block Until Done tool before, and the workflow still generated errors when writing multiple sheets to one Excel file.  One of the errors was "unable to create a backup copy of xyz.xlsx".

 

The only option that seems to work for me every time is to use a batch macro, plus a Wait a Second macro, to write different formats/schemas to multiple Sheets in one Excel file.  But this method adds to the runtime, by using the Wait a Second macro.

 

Excel output enhancement - must now use a Macro and Wait a Second.jpg

 

Please consider adding a Like to this related idea:  Enhance options for Excel output

https://community.alteryx.com/t5/Alteryx-Designer-Ideas/Enhance-options-for-Excel-output/idi-p/84326...

 

Chris

Labels