0

I'm working on a flutter application that would collect some data from user and send them to cloud function. I wanted to know if it's possible to convert the incoming data to CSV format and append it to the CSV file in cloud storage. I want to use this file in AutoMl Entity extraction.

To be precise...

How to Append data to text file in cloud storage using cloud functions.

Abhijeet Dash
  • 146
  • 1
  • 10

1 Answers1

1

It's not possible to directly modify a file stored in Cloud Storage Buckets.

The best workaround for this situation would be to download the file, edit it and upload it again.

In order to download the file you can follow this guide, you should store the file to the /tmp directory as this is the recommended directory to store temporary files in Cloud Functions. Please note that this directory is in-memory, therefore it will be emptied between different invocations of the Cloud Function.

Then you can append data to it using an approach similar to the ones described in these questions nodejs / python.

Lastly, you can upload the file to the Cloud Storage Bucket following this guide.

Lluís Muñoz
  • 409
  • 3
  • 11