CSV file with corona ?

I am trying to export a CSV file from the corona or some other option for exporting data that will be created by the application user … (The data is a 5 text and a 5 numbers … Also has a photo, but a photo would not be necessary without being non-CSV)

Anyone know any method? Thanks

You can easily write a csv exporter (and importer for that matter).

It really depends a lot on the way you’re storing your data.

With SSK 2 (to simplify file writing), you could do this:

require "ssk2.loadSSK" \_G.ssk.init() -- Some 'dummy data' for our example local exampleData = {} exampleData[1] = { age = 21, name = "Bob", job = "Engineer" } exampleData[2] = { age = 32, name = "Billy", job = "Game Developer" } exampleData[3] = { age = 50, name = "Joe", job = "Retired" } -- Create first line of CSV io.writeFile( "name,age,job\n", "exampleData.csv" ) -- Append remainder of lines to file for i = 1, #exampleData do local out = exampleData[i].name out = out .. "," .. exampleData[i].age out = out .. "," .. exampleData[i].job out = out .. "\n" io.appendFile( out, "exampleData.csv" ) end

This would save a file containing this:

name,age,job Bob,21,Engineer Billy,32,Game Developer Joe,50,Retired

Sorry for the delay to the answer, I was finishing the project … So, just one thing I did not understand … Where does the CSV export?

I took a look not GitHub but even then I could not figure out where the CSV file is archived … T-T

I already found hahahahhaha was in the sandbox … Is there any method for me to leave the CSV somewhere else? : \

On mobile iOS, No, not really.

On mobile Android, Yes, but getting out of the sandbox is a lot more work and requires specific details about the system you’re on.

On desktop, Yes.  You can use my files utilities: https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/files/

Note: In the latter case, you may still be constrained by Virus scanners and other resident protective features in the OS.

Alternately, you can DIY via lfs.* https://docs.coronalabs.com/api/library/lfs/index.html

What I wanted to say was that when the person uses the APK he can save the CSV files to a folder and then when the user connects the cell via USB he creates the file … =\ If it really is not how would be interesting some method to put the CSV on the cloud somehow … More reliable than doing the genre because it can put the file in the nub, owe it, too much knowledge, so i am trying to ignore this option =\

What I wanted to say was that when the person uses the APK he can save the CSV files to a folder and then when the user connects the cell via USB he creates the file … = \ If it really is not how would be interesting some method to put the CSV on the cloud somehow … More reliable than doing the genre because it can put the file in the nub, owe it, too much knowledge, so i am trying to ignore this option

I didn’t understand that.   It was hard to read and seemed to contain both run-ons and incomplete questions.  Also, you double pasted or something.

For future reference, take the time to make your questions legible and very easily understood and you will get better help.

  • Use paragrapahs
  • Use line breaks and gaps between paragraphs.
  • Use complete sentences.
  • Read it after you post it, then correct any issues that make it hard to understand.

If this seems like a lot, think about it from my perspective, I want to help but your question is really unclear.  So, I’m left guessing.

Having said all that … I think you were asking:

1. For Android builds, Is it possible to write to a folder that can later be accessed from my PC/Mac when the mobile device is connected to it via USB?

Answer: Yes, but I can’t help you with this.  

As I said before this requires details about each Android device I don’t know so I can’t give you precise steps.  Android devices are not entirely consistent in the way they organize the file-system and externally visible folders.

2. Is there a way to put this in the cloud?  

Answer: Sure, there are many ways.  Too many to list here, see below.

Question: Have you looked in the Marketplace for solutions?  There may be plugins to help you with this:

Sorry, I’m using google translator and it translates very wrong, sometimes I realize some errors but I do not have fluency in English to fix them: \ And yes, I meant exactly what you said, if there was any way I could save the CSV file in a directory to be accessed via USB connection. I’ll read the links you gave me and I’ll tell you. Again, sorry for the Google translator, and thank you very much for your efforts to read. =)

Well, almost all the examples you put here did not work: \ You had one that was giving the following error: "20: 52: 50.085 WARNING: The ‘plugin.androidFileShare’ library is not available on this platform. "Do you know how to solve it? = \

Plugins Working or Not Working

All of the leads (pluing links) I gave you work just fine for what they do and the purpose their authors had in mind.

I am quite sure for example that the AWS S3 plugin would allow you to upload and download files from an S3 bucket.

Whether the plugins I suggested will get you close to a solution, I could not know.   Remember, I was unclear on what you wanted.

I know you probably want a simple drop-in solution that takes a few lines of code to use, but I really don’t think you’ll find that. 

The two things you’re trying to do will both require significant work.

Message

As far as the ‘plugin.androidFileShare’ message.  I don’t know what plugin you’re referring to.  Which one gave this message.

Did you read the documentation for that plugin?   All those plugins should come with examples.  Did you run the examples?

Anyways, from the look of that message my guess is:

  • you didn’t activate the plugin (in the store)

AND/OR

  • you didn’t put the right settings in the build.settings file.

Out Of Time

I’m afraid that is the limit of my help time for today.  I hope some other folks have other ideas for you.

Sorry for the delay to answer you, I was finishing the Application and it cost me a lot of time :\ Well, I still have the same problem that is like sharing a file that is in the system folder … :frowning:

I’m afraid I don’t understand what you’re trying to convey here.  

Can you more clearly describe the problem you’re having as a sequence of events or steps then say what is wrong.

A good way to do this is:

  • tell me what you did (keep it short, but be clear)
  • tell me what you saw as a result
  • tell me what you expected to see
  • tell me what you did to debug this 

@roaminggamer he is referring to my plugin

@pabloapdz that “warning”, “not error” will appear on device that don’t support the api. android file share only work on android not corona simulator. You won’t get “error” but warnings.

You can easily write a csv exporter (and importer for that matter).

It really depends a lot on the way you’re storing your data.

With SSK 2 (to simplify file writing), you could do this:

require "ssk2.loadSSK" \_G.ssk.init() -- Some 'dummy data' for our example local exampleData = {} exampleData[1] = { age = 21, name = "Bob", job = "Engineer" } exampleData[2] = { age = 32, name = "Billy", job = "Game Developer" } exampleData[3] = { age = 50, name = "Joe", job = "Retired" } -- Create first line of CSV io.writeFile( "name,age,job\n", "exampleData.csv" ) -- Append remainder of lines to file for i = 1, #exampleData do local out = exampleData[i].name out = out .. "," .. exampleData[i].age out = out .. "," .. exampleData[i].job out = out .. "\n" io.appendFile( out, "exampleData.csv" ) end

This would save a file containing this:

name,age,job Bob,21,Engineer Billy,32,Game Developer Joe,50,Retired

Sorry for the delay to the answer, I was finishing the project … So, just one thing I did not understand … Where does the CSV export?

I took a look not GitHub but even then I could not figure out where the CSV file is archived … T-T

I already found hahahahhaha was in the sandbox … Is there any method for me to leave the CSV somewhere else? : \

On mobile iOS, No, not really.

On mobile Android, Yes, but getting out of the sandbox is a lot more work and requires specific details about the system you’re on.

On desktop, Yes.  You can use my files utilities: https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/files/

Note: In the latter case, you may still be constrained by Virus scanners and other resident protective features in the OS.

Alternately, you can DIY via lfs.* https://docs.coronalabs.com/api/library/lfs/index.html

What I wanted to say was that when the person uses the APK he can save the CSV files to a folder and then when the user connects the cell via USB he creates the file … =\ If it really is not how would be interesting some method to put the CSV on the cloud somehow … More reliable than doing the genre because it can put the file in the nub, owe it, too much knowledge, so i am trying to ignore this option =\

What I wanted to say was that when the person uses the APK he can save the CSV files to a folder and then when the user connects the cell via USB he creates the file … = \ If it really is not how would be interesting some method to put the CSV on the cloud somehow … More reliable than doing the genre because it can put the file in the nub, owe it, too much knowledge, so i am trying to ignore this option

I didn’t understand that.   It was hard to read and seemed to contain both run-ons and incomplete questions.  Also, you double pasted or something.

For future reference, take the time to make your questions legible and very easily understood and you will get better help.

  • Use paragrapahs
  • Use line breaks and gaps between paragraphs.
  • Use complete sentences.
  • Read it after you post it, then correct any issues that make it hard to understand.

If this seems like a lot, think about it from my perspective, I want to help but your question is really unclear.  So, I’m left guessing.

Having said all that … I think you were asking:

1. For Android builds, Is it possible to write to a folder that can later be accessed from my PC/Mac when the mobile device is connected to it via USB?

Answer: Yes, but I can’t help you with this.  

As I said before this requires details about each Android device I don’t know so I can’t give you precise steps.  Android devices are not entirely consistent in the way they organize the file-system and externally visible folders.

2. Is there a way to put this in the cloud?  

Answer: Sure, there are many ways.  Too many to list here, see below.

Question: Have you looked in the Marketplace for solutions?  There may be plugins to help you with this:

Sorry, I’m using google translator and it translates very wrong, sometimes I realize some errors but I do not have fluency in English to fix them: \ And yes, I meant exactly what you said, if there was any way I could save the CSV file in a directory to be accessed via USB connection. I’ll read the links you gave me and I’ll tell you. Again, sorry for the Google translator, and thank you very much for your efforts to read. =)