Best answer

How to designate a worksheet on a newly created Google Sheet?

  • 3 February 2021
  • 3 replies
  • 107 views

Userlevel 1

I’m extracting an attachment from an email that is in xlsx format, and need a way to copy the data from the attachment into a Google Sheet. 

The new gmail with attachment is the trigger. Step 2 is to upload the file to Google Drive.

Step 3 is to copy the file, using the “convert to document” option, which turns it into a Google Sheet.

In Step 4, I am trying to “Lookup Spreadsheet Row in Google Sheets”, for the spreadsheet just created in step 3.

I can use a custom value to select the spreadsheet (by pointing to the ID from step 3), but can only select the worksheet for that particular spreadsheet - as subsequent spreadsheets are created by the zap, it errors at step four because it’s not pointing to the correct worksheet. 

Is there any workaround for this? 

icon

Best answer by GetUWired 3 February 2021, 23:56

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +12

I am assuming the excel files are formatted the same? Once you get it matched to the worksheet the Col you are looking at doesn’t change? As an example, it’s always Col$C that is getting searched. 

This isn’t the most ideal solution because it would create duplicate files but immediately following the Create
Trigger stays the same

Step 2. Upload the file with “Convert to document” set to True. 

Step 3. Create Spreadsheet using Google Sheets where you give it the id of the file uploaded in step 2. (this is where you will end up with a duplicated file) but this action returns the spreadsheet id as well as the work sheet

Step 4: Look up Spreadsheet row hardcoding the column you are looking at. 
 



The above would be a no code solution. I think it could also be possible using a code block and reading the csv file that is returned once the file is initially uploaded to avoid the duplicate. 

Userlevel 1

This worked! Solved the problem of not being able to dynamically select the worksheet before. And since it was technically creating two files in Google Drive before (one xlsx and one Sheet), the duplication isn’t that big of a deal… a little clumsy but mission accomplished. Thank you!

Userlevel 7
Badge +12

@marrsgirl 

Always happy to help!