Action.ExportQuery

Questions & Answers about Helium Scraper 3
Post Reply
yeti
Posts: 22
Joined: Sat Feb 02, 2013 1:01 am

Action.ExportQuery

Post by yeti » Fri Jan 21, 2022 4:54 pm

Hello,

I would like to automatically export joined data into a CSV.

I have created a Query which works and can be exported manually into a CSV fine.

I am attempting to use the Action.ExportQuery function to export the data into a CSV automatically.

The query is named Joineddata

Code: Select all

Action.ExportQuery
   ·  "Joineddata"
   ·  "C:\\query.csv"
   ·  true
However I am getting the following error:

Code: Select all

01/21/2022 16:47:51	
	1 | Execution failed with unexpected error: 
	1 |   SQL logic error
	1 |   no such table: Joineddata
Please could you give me a hint as to where I am going wrong?

Thank you.

webmaster
Site Admin
Posts: 521
Joined: Mon Dec 06, 2010 8:39 am
Contact:

Re: Action.ExportQuery

Post by webmaster » Sat Jan 22, 2022 4:48 pm

This function needs an actual query, not a query name as the first argument, so something like this would work:

Code: Select all

Action.ExportQuery
   ·  "select * from MyTable"
   ·  "hello.csv"
   ·  true
If the query is large or has multiple lines, you can also use a script at Project Explorer > Scripting > Scripts since scripts can hold any arbitrary text. Just create a new script called MyQuery, then delete the default code, copy/paste your query and press the little save button. Then instead of the above code you can use this:

Code: Select all

Action.ExportQuery
   ·  Script.MyQuery
   ·  "hello.csv"
   ·  true
Juan Soldi
The Helium Scraper Team

yeti
Posts: 22
Joined: Sat Feb 02, 2013 1:01 am

Re: Action.ExportQuery

Post by yeti » Mon Jan 24, 2022 12:46 pm

The script functionality worked perfectly, thank you! :mrgreen:

Post Reply