You should be able to make an AJAX request from your javascript to grab 
that file from your server.  Using jQuery, it would look something like 
this:

function drawChart() {
    $.ajax({
        url: 'path/to/file',
        type: 'json',
        success: function (json) {
            var data = google.visualization.arrayToDataTable(json);
            
            // do something with data
        }
    });
}
google.setOnLoadCallback(drawChart);
google.load("visualization", "1", {packages:[/* whatever packages you need 
*/]});

To use that code, you will need to load the jQuery library (if you don't 
already):

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" 
></script>

You can write an equivalent AJAX call without jQuery, but this way is 
easier.

On Friday, August 2, 2013 4:00:11 PM UTC-4, kpj wrote:
>
> the structure looks like this
>  
> [
> [
> 'ID', 
> 'Label', 
> 'Longitude', 
> 'Latitude', 
> 'Country', 
> 'City', 
> 'Inventory', 
> 'Safety stock', 
> 'Ttl_wght_flw_thru', 
> ],
> [
> 'AFKBL', 
> 'Kabul, Afghanistan', 
> 69.136749, 
> 34.53091, 
> 'Afghanistan', 
> 'Kabul', 
> 12, 
> 1845, 
> 1304, 
> ],
> [
> 'AFKDH', 
> 'Kandahar, Afghanistan', 
> 65.700279, 
> 31.61087, 
> 'Afghanistan', 
> 'Kandahar', 
> 18, 
> 1193, 
> 151029, 
> ]
>  
> if you want to see the code , i will send it in an attachment
>  
> thanks
>  
>  
>
> On Friday, August 2, 2013 2:22:50 PM UTC-5, asgallant wrote:
>
>> What does the structure of the text file look like?
>>
>> On Friday, August 2, 2013 3:09:56 PM UTC-4, kpj wrote:
>>>
>>> Thanks for your response
>>>  
>>> I have already formatted my excel sheet data and wrote it in a different 
>>> text file.
>>> My aim is to read the formatted data from that text file and use it in 
>>> the charts.
>>> Is it possible to do that?
>>>  
>>> Thanks in advance.
>>>  
>>>
>>> On Friday, August 2, 2013 11:33:27 AM UTC-5, asgallant wrote:
>>>
>>>> If you want to read data live from your Excel sheet, you need 
>>>> server-side code that is capable of reading Excel.  I am given to 
>>>> understand that there are some tools from Microsoft that can hook in to 
>>>> ASP.net and read Excel files, but I don't know where you can get them. 
>>>>  Reading Excel files in other scripting languages is difficult at best.  
>>>> As 
>>>> an alternative, if your needs permit it, you can import the Excel file 
>>>> into 
>>>> Google Spreadsheets and query the data from there.
>>>>
>>>> If you don't need to read the data live, then you can export the data 
>>>> to your javascript and format it for input into the DataTable.
>>>>
>>>> On Friday, August 2, 2013 9:29:25 AM UTC-4, kpj wrote:
>>>>>
>>>>> Hello,
>>>>>  
>>>>> I have data in my excel sheet.
>>>>> I have written a VBA function which converts my data in to array 
>>>>> format( which looks exactly like the data in google charts examples)
>>>>> But, I dont know how to Read my array into
>>>>>  var data = google.visualization.arrayToDataTable(
>>>>> I got my data array written into another file which has a function 
>>>>> FillSourceArray()
>>>>> and i am calling that function into the VBA function using DataArray = 
>>>>> FillSourceArray()
>>>>> I am not sure about how to read the data.
>>>>>  
>>>>> Thanks in advance
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to