Firestore Import
by apify
Effortlessly import Apify datasets into Firebase Firestore. Control document IDs, handle conflicts, and transform data with custom logic for a smooth automation workflow.
Opens on Apify.com
About Firestore Import
Need to get your Apify dataset into Firebase Firestore without the headache? This actor is your straightforward solution. I've used it to move scraped product catalogs and contact lists directly into Firestore, and it saves a ton of time you'd otherwise spend writing manual scripts. You get full control over how the data lands: set your own document IDs, decide what happens if a record already exists (overwrite it, merge the new data, or just skip it), and even tweak the data on the fly with a custom JavaScript function. This is perfect for developers who are automating data pipelines, syncing information between platforms, or just need a reliable way to populate a Firestore database from their Apify runs. It handles the connection and the logic, so you can focus on what to do with the data once it's in place. If you're working with Apify and Firebase, this is one of those essential utilities that just works.
What does this actor do?
Firestore Import is a web scraping and automation tool available on the Apify platform. It's designed to help you extract data and automate tasks efficiently in the cloud.
Key Features
- Cloud-based execution - no local setup required
- Scalable infrastructure for large-scale operations
- API access for integration with your applications
- Built-in proxy rotation and anti-blocking measures
- Scheduled runs and webhooks for automation
How to Use
- Click "Try This Actor" to open it on Apify
- Create a free Apify account if you don't have one
- Configure the input parameters as needed
- Run the actor and download your results
Documentation
Firestore Import Actor
This Apify actor imports data from an Apify dataset into a Firebase Firestore database. It provides flexible configuration for handling data conflicts, transforming records, and controlling how documents are created or updated.
Overview
The actor takes structured data from an Apify dataset and writes it to a specified collection in your Firestore database. You can control the target collection, generate or specify document IDs, and define how to handle existing documents. It's useful for automating data pipelines between Apify's scraping platform and Google's Firestore.
Key Features
- Flexible Data Import: Imports data from any Apify dataset into a Firestore collection.
- Configurable Document IDs: Use a field from your dataset as the document ID, or let Firestore auto-generate them.
- Conflict Resolution: Choose to overwrite, merge, or skip existing documents when IDs clash.
- Data Transformation: Apply a custom JavaScript function to modify dataset items before import. This function can also specify different collections or IDs for individual records.
- Batch Operations: Uses Firestore's batch writes for efficient performance (except when using the
skipconflict resolution).
How to Use
- Set up Firestore: In the Firebase Console, generate a service account key (JSON) for your project.
- Prepare Data: Ensure your data is in an Apify dataset.
- Configure the Actor: In the actor's input, provide your service account key, dataset ID, and target collection.
- Run: Start the actor. It will process your dataset and import the records into Firestore.
Input
The actor requires the following configuration via its input fields:
-
serviceAccountKey(string, secret, required)
The full JSON service account key from Firebase. Get this from Firebase Console > Project Settings > Service accounts > Generate new private key. This value is stored encrypted. -
datasetId(string, required)
The ID of the Apify dataset containing the data to import. -
collection(string, required)
The name of the Firestore collection to import into. It will be created if it doesn't exist. You can override this per-document in thetransformFunction. -
databaseName(string, optional)
The specific Firestore database name. Uses the default"(default)"database if not provided. -
idField(string, optional)
A field name from your dataset items (must be string or number) to use as the Firestore document ID. If not set, Firestore will auto-generate all IDs, anddocumentConflictResolutionis ignored. -
documentConflictResolution(enum, required)
Defines how to handle documents that already exist in Firestore:overwrite: Completely replaces the existing document.merge: Merges the new data with the existing document fields.skip: Skips the import for documents with an existing ID. Note: This option performs individual document checks and cannot use batch writes, which significantly reduces performance for large datasets.
-
transformFunction(string, optional)
A JavaScript function that receives a dataset item and returns an object (or array of objects) to be written to Firestore. Use this to clean, reshape, or route your data.
javascript // Example: Transform item and assign to a sub-collection. function transform(item) { // Return a single document configuration. return { collection: `users/${item.userId}/posts`, // Write to a sub-collection id: item.slug, // Custom ID data: { // The document data title: item.title, published: new Date(item.timestamp) } }; // Or return an array to create multiple documents from one item. }
Output
The actor outputs a summary of the import operation to the Apify dataset named RESULTS. This dataset contains a single record with execution details:
importSummary: An object with counts liketotalProcessedItems,successfulWrites, andskippedItems.errorSummary: An array listing any errors that occurred during the import, if applicable.
You can access this dataset via the Apify API or through the run console to verify the results.
Categories
Common Use Cases
Market Research
Gather competitive intelligence and market data
Lead Generation
Extract contact information for sales outreach
Price Monitoring
Track competitor pricing and product changes
Content Aggregation
Collect and organize content from multiple sources
Ready to Get Started?
Try Firestore Import now on Apify. Free tier available with no credit card required.
Start Free TrialActor Information
- Developer
- apify
- Pricing
- Paid
- Total Runs
- 2,854
- Active Users
- 9
Related Actors
Video Transcript Scraper: Youtube, X, Facebook, Tiktok, etc.
by invideoiq
Linkedin Profile Details Scraper + EMAIL (No Cookies Required)
by apimaestro
Twitter (X.com) Scraper Unlimited: No Limits
by apidojo
Content Checker
by jakubbalada
Apify provides a cloud platform for web scraping, data extraction, and automation. Build and run web scrapers in the cloud.
Learn more about ApifyNeed Professional Help?
Couldn't solve your problem? Hire a verified specialist on Fiverr to get it done quickly and professionally.
Trusted by millions | Money-back guarantee | 24/7 Support